aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Shaped/Shape.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Shaped/Shape.hs')
-rw-r--r--src/Data/Array/Nested/Shaped/Shape.hs21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/Data/Array/Nested/Shaped/Shape.hs b/src/Data/Array/Nested/Shaped/Shape.hs
index c39d482..274f954 100644
--- a/src/Data/Array/Nested/Shaped/Shape.hs
+++ b/src/Data/Array/Nested/Shaped/Shape.hs
@@ -89,9 +89,6 @@ listsShow f l = showString "[" . go "" l . showString "]"
go _ ZS = id
go prefix (x ::$ xs) = showString prefix . f x . go "," xs
-listsLength :: ListS sh i -> Int
-listsLength = length
-
listsRank :: ListS sh i -> SNat (Rank sh)
listsRank ZS = SNat
listsRank (_ ::$ sh) = snatSucc (listsRank sh)
@@ -114,17 +111,9 @@ listsFromListS topl0 topl = go topl0 topl
go ZS [] = ZS
go (_ ::$ l0) (i : is) = i ::$ go l0 is
go _ _ = error $ "listsFromListS: Mismatched list length (the model says "
- ++ show (listsLength topl0) ++ ", list has length "
+ ++ show (length topl0) ++ ", list has length "
++ show (length topl) ++ ")"
-{-# INLINEABLE listsToList #-}
-listsToList :: ListS sh i -> [i]
-listsToList list = build (\(cons :: i -> is -> is) (nil :: is) ->
- let go :: ListS sh i -> is
- go ZS = nil
- go (i ::$ is) = i `cons` go is
- in go list)
-
listsHead :: ListS (n : sh) i -> i
listsHead (i ::$ _) = i
@@ -208,9 +197,6 @@ instance Show i => Show (IxS sh i) where
showsPrec _ (IxS l) = listsShow (\i -> shows i) l
#endif
-ixsLength :: IxS sh i -> Int
-ixsLength (IxS l) = listsLength l
-
ixsRank :: IxS sh i -> SNat (Rank sh)
ixsRank (IxS l) = listsRank l
@@ -221,9 +207,6 @@ ixsFromList = coerce (listsFromList @_ @i)
ixsFromIxS :: forall sh i0 i. IxS sh i0 -> [i] -> IxS sh i
ixsFromIxS = coerce (listsFromListS @_ @i0 @i)
-ixsToList :: IxS sh i -> [i]
-ixsToList = Foldable.toList
-
ixsZero :: ShS sh -> IIxS sh
ixsZero ZSS = ZIS
ixsZero (_ :$$ sh) = 0 :.$ ixsZero sh
@@ -481,7 +464,7 @@ shsOrthotopeShape (SNat :$$ sh) | Dict <- shsOrthotopeShape sh = Dict
instance KnownShS sh => IsList (ListS sh i) where
type Item (ListS sh i) = i
fromList = listsFromList (knownShS @sh)
- toList = listsToList
+ toList = Foldable.toList
-- | Very untyped: only length is checked (at runtime), index bounds are __not checked__.
instance KnownShS sh => IsList (IxS sh i) where