From 0028b655341069e83db6e0bfde01dea1c696f5aa Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Mon, 1 Dec 2025 17:15:05 +0100 Subject: Unify toList functions for shapes --- src/Data/Array/Nested/Mixed/Shape.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Data/Array/Nested/Mixed') diff --git a/src/Data/Array/Nested/Mixed/Shape.hs b/src/Data/Array/Nested/Mixed/Shape.hs index a9ed2d0..4626481 100644 --- a/src/Data/Array/Nested/Mixed/Shape.hs +++ b/src/Data/Array/Nested/Mixed/Shape.hs @@ -140,6 +140,7 @@ listxFromList topssh topl = go topssh topl ++ show (ssxLength topssh) ++ ", list has length " ++ show (length topl) ++ ")" +{-# INLINEABLE listxToList #-} listxToList :: ListX sh' (Const i) -> [i] listxToList ZX = [] listxToList (Const i ::% is) = i : listxToList is @@ -219,6 +220,9 @@ 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 null ZIX = False null _ = True @@ -441,6 +445,7 @@ shxFromList topssh topl = go topssh topl ++ show (ssxLength topssh) ++ ", list has length " ++ show (length topl) ++ ")" +{-# INLINEABLE shxToList #-} shxToList :: IShX sh -> [Int] shxToList ZSX = [] shxToList (smn :$% sh) = fromSMayNat' smn : shxToList sh -- cgit v1.2.3-70-g09d2