aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Mixed/Shape.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-12-02 15:01:26 +0100
committerTom Smeding <tom@tomsmeding.com>2025-12-02 15:01:26 +0100
commitf76d781c75105b7b04ed2e602f0139d35846ab92 (patch)
tree2ae7357a52f8c2e302332cd8d7754c23fe5be511 /src/Data/Array/Nested/Mixed/Shape.hs
parent9f47aa6a2bcd772388a5d5150ca7254e4eb95bc2 (diff)
Style and uniformity of shape/index/list functions
Diffstat (limited to 'src/Data/Array/Nested/Mixed/Shape.hs')
-rw-r--r--src/Data/Array/Nested/Mixed/Shape.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Data/Array/Nested/Mixed/Shape.hs b/src/Data/Array/Nested/Mixed/Shape.hs
index ed03310..8aa5a77 100644
--- a/src/Data/Array/Nested/Mixed/Shape.hs
+++ b/src/Data/Array/Nested/Mixed/Shape.hs
@@ -217,9 +217,7 @@ instance Foldable (IxX sh) where
{-# INLINE foldr #-}
foldr _ z ZIX = z
foldr f z (x :.% xs) = f x (foldr f z xs)
- {-# INLINEABLE toList #-}
- toList ZIX = []
- toList (i :.% is) = i : Foldable.toList is
+ toList = ixxToList
null ZIX = False
null _ = True
@@ -242,6 +240,10 @@ ixxZero' (_ :$% sh) = 0 :.% ixxZero' sh
ixxFromList :: forall sh i. StaticShX sh -> [i] -> IxX sh i
ixxFromList = coerce (listxFromList @_ @i)
+{-# INLINEABLE ixxToList #-}
+ixxToList :: forall sh i. IxX sh i -> [i]
+ixxToList = coerce (listxToList @_ @i)
+
ixxHead :: IxX (n : sh) i -> i
ixxHead (IxX list) = getConst (listxHead list)