aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Shaped
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Shaped')
-rw-r--r--src/Data/Array/Nested/Shaped/Shape.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Data/Array/Nested/Shaped/Shape.hs b/src/Data/Array/Nested/Shaped/Shape.hs
index eb8653d..0a4c1b9 100644
--- a/src/Data/Array/Nested/Shaped/Shape.hs
+++ b/src/Data/Array/Nested/Shaped/Shape.hs
@@ -237,9 +237,7 @@ instance Foldable (IxS sh) where
{-# INLINE foldr #-}
foldr _ z ZIS = z
foldr f z (x :.$ xs) = f x (foldr f z xs)
- {-# INLINEABLE toList #-}
- toList ZIS = []
- toList (i :.$ is) = i : Foldable.toList is
+ toList = ixsToList
null ZIS = False
null _ = True
@@ -254,6 +252,9 @@ ixsRank (IxS l) = listsRank l
ixsFromList :: forall sh i. ShS sh -> [i] -> IxS sh i
ixsFromList = coerce (listsFromList @_ @i)
+ixsToList :: forall sh i. IxS sh i -> [i]
+ixsToList = coerce (listsToList @_ @i)
+
ixsZero :: ShS sh -> IIxS sh
ixsZero ZSS = ZIS
ixsZero (_ :$$ sh) = 0 :.$ ixsZero sh
@@ -349,7 +350,7 @@ shsSize :: ShS sh -> Int
shsSize ZSS = 1
shsSize (n :$$ sh) = fromSNat' n * shsSize sh
--- This is a partial @const@ that fails when the second argument
+-- | This is a partial @const@ that fails when the second argument
-- doesn't match the first.
shsFromList :: ShS sh -> [Int] -> ShS sh
shsFromList sh0@ZSS [] = sh0