diff options
| author | Tom Smeding <tom@tomsmeding.com> | 2026-03-14 11:52:03 +0100 |
|---|---|---|
| committer | Tom Smeding <tom@tomsmeding.com> | 2026-03-14 12:01:53 +0100 |
| commit | 8c27d35a43a18c7c169ea67ba131b94f10c4b25b (patch) | |
| tree | 3c8e54ef1157108a7190df9b12c8d69450f229e8 /src/Data/Array/XArray.hs | |
| parent | 832d9fb15b1d738c81f347b892d2af3b7663cafb (diff) | |
Variable naming and doc comments
Diffstat (limited to 'src/Data/Array/XArray.hs')
| -rw-r--r-- | src/Data/Array/XArray.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Data/Array/XArray.hs b/src/Data/Array/XArray.hs index f3a1053..4514043 100644 --- a/src/Data/Array/XArray.hs +++ b/src/Data/Array/XArray.hs @@ -351,18 +351,15 @@ toListOuter (XArray arr@(ORS.A (ORG.A shArr t))) = [_] | Refl <- (unsafeCoerceRefl :: sh :~: '[]) -> coerce (map S.scalar $ S.toList arr) n : sh -> coerce $ map (ORG.A sh . OI.indexT t) [0 .. n - 1] --- | If @n@ is an 'SKnown' dimension, the list is streamed. If @n@ is unknown, --- the list's spine must be fully materialised to compute its length before --- constructing the array. +-- | Performance note: the list's spine is fully materialised to compute its +-- length before traversing it again to construct the array. {-# INLINE fromList1 #-} fromList1 :: Storable a => [a] -> XArray '[Nothing] a fromList1 l = let n = length l -- avoid S.fromList because it takes a length _and_ does another length check itself in XArray (S.fromVector [n] (VS.fromListN n l)) --- | If @n@ is an 'SKnown' dimension, the list is streamed. If @n@ is unknown, --- the list's spine must be fully materialised to compute its length before --- constructing the array. +-- | The list is streamed. {-# INLINE fromList1SN #-} fromList1SN :: Storable a => SNat n -> [a] -> XArray '[Just n] a fromList1SN m l = |
