aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/XArray.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/XArray.hs')
-rw-r--r--src/Data/Array/XArray.hs9
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 =