diff options
| author | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2026-04-04 16:26:06 +0200 |
|---|---|---|
| committer | Mikolaj Konarski <mikolaj.konarski@funktory.com> | 2026-04-04 20:52:32 +0200 |
| commit | ee319119b1f24db2b2e981e303db9935a1dca425 (patch) | |
| tree | 818218affd29d640b7842c8ef668964f556a30c7 /src/Data/Array/Nested/Ranked | |
| parent | 53bc096c807fc63cfe5f1102131b475deb5e21ca (diff) | |
Remove copies of length and toList operations that Foldable already provides
in preparation for deriving Foldable for []
Diffstat (limited to 'src/Data/Array/Nested/Ranked')
| -rw-r--r-- | src/Data/Array/Nested/Ranked/Shape.hs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/Data/Array/Nested/Ranked/Shape.hs b/src/Data/Array/Nested/Ranked/Shape.hs index 6d94c8d..2166123 100644 --- a/src/Data/Array/Nested/Ranked/Shape.hs +++ b/src/Data/Array/Nested/Ranked/Shape.hs @@ -113,9 +113,6 @@ listrShow f l = showString "[" . go "" l . showString "]" go _ ZR = id go prefix (x ::: xs) = showString prefix . f x . go "," xs -listrLength :: ListR n i -> Int -listrLength = length - listrRank :: ListR n i -> SNat n listrRank ZR = SNat listrRank (_ ::: sh) = snatSucc (listrRank sh) @@ -134,14 +131,6 @@ listrFromList topsn topl = go topsn topl ++ show (fromSNat topsn) ++ ", list has length " ++ show (length topl) ++ ")" -{-# INLINEABLE listrToList #-} -listrToList :: ListR n i -> [i] -listrToList list = build (\(cons :: i -> is -> is) (nil :: is) -> - let go :: ListR n i -> is - go ZR = nil - go (i ::: is) = i `cons` go is - in go list) - listrHead :: ListR (n + 1) i -> i listrHead (i ::: _) = i @@ -237,9 +226,6 @@ instance Show i => Show (IxR n i) where showsPrec _ (IxR l) = listrShow shows l #endif -ixrLength :: IxR sh i -> Int -ixrLength (IxR l) = listrLength l - ixrRank :: IxR n i -> SNat n ixrRank (IxR sh) = listrRank sh @@ -251,9 +237,6 @@ ixrZero (SS n) = 0 :.: ixrZero n ixrFromList :: forall n i. SNat n -> [i] -> IxR n i ixrFromList = coerce (listrFromList @_ @i) -ixrToList :: IxR n i -> [i] -ixrToList = Foldable.toList - ixrHead :: IxR (n + 1) i -> i ixrHead (IxR list) = listrHead list |
