From f76d781c75105b7b04ed2e602f0139d35846ab92 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 2 Dec 2025 15:01:26 +0100 Subject: Style and uniformity of shape/index/list functions --- src/Data/Array/Nested/Mixed/Shape.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (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 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) -- cgit v1.2.3-70-g09d2