From 604c1b4dd670d97a168153ca63242bc43be73b9c Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Tue, 6 Jan 2026 11:30:56 +0100 Subject: Document that mshapeTree is partial --- src/Data/Array/Nested/Mixed.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Data/Array') diff --git a/src/Data/Array/Nested/Mixed.hs b/src/Data/Array/Nested/Mixed.hs index deb32b2..667edd7 100644 --- a/src/Data/Array/Nested/Mixed.hs +++ b/src/Data/Array/Nested/Mixed.hs @@ -357,6 +357,9 @@ class Elt a where -- | Tree giving the shape of every array component. type ShapeTree a + -- | Produces an internal representation of a tree of shapes of (potentially) + -- nested arrays. If the argument is an array, it requires that the array + -- is not empty (it's guaranteed to crash early otherwise). mshapeTree :: a -> ShapeTree a mshapeTreeEq :: Proxy a -> ShapeTree a -> ShapeTree a -> Bool @@ -696,6 +699,7 @@ instance Elt a => Elt (Mixed sh' a) where type ShapeTree (Mixed sh' a) = (IShX sh', ShapeTree a) + -- This requires that @arr@ is not empty. mshapeTree :: Mixed sh' a -> ShapeTree (Mixed sh' a) mshapeTree arr = (mshape arr, mshapeTree (mindex arr (ixxZero (ssxFromShX (mshape arr))))) -- cgit v1.2.3-70-g09d2