diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2025-04-26 10:27:39 +0200 | 
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2025-04-26 10:27:39 +0200 | 
| commit | 8db33035826609bf48e15a82742981a58a0b5982 (patch) | |
| tree | 848bf1bcfbd31a67c01b740c0065870f837543eb /src/Data/Array/Mixed | |
| parent | a6f2809ed7e245d5eee4704b152783b4672cc212 (diff) | |
Refactor the clever replicate-aware Show instances
Diffstat (limited to 'src/Data/Array/Mixed')
| -rw-r--r-- | src/Data/Array/Mixed/XArray.hs | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/src/Data/Array/Mixed/XArray.hs b/src/Data/Array/Mixed/XArray.hs index 91a11ed..93484dc 100644 --- a/src/Data/Array/Mixed/XArray.hs +++ b/src/Data/Array/Mixed/XArray.hs @@ -15,6 +15,9 @@  module Data.Array.Mixed.XArray where  import Control.DeepSeq (NFData) +import Data.Array.Internal.RankedG qualified as ORG +import Data.Array.Internal.RankedS qualified as ORS +import Data.Array.Internal qualified as OI  import Data.Array.Ranked qualified as ORB  import Data.Array.RankedS qualified as S  import Data.Coerce @@ -59,6 +62,12 @@ fromVector sh v  toVector :: Storable a => XArray sh a -> VS.Vector a  toVector (XArray arr) = S.toVector arr +-- | This allows observing the strides in the underlying orthotope array. This +-- can be useful for optimisation, but should be considered an implementation +-- detail: strides may change in new versions of this library without notice. +arrayStrides :: XArray sh a -> [Int] +arrayStrides (XArray (ORS.A (ORG.A _ (OI.T strides _ _)))) = strides +  scalar :: Storable a => a -> XArray '[] a  scalar = XArray . S.scalar | 
