From de1250a6837cc3b8cf168905e360845e9082c7d2 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 20 Apr 2024 22:42:30 +0200 Subject: toList --- src/Data/Array/Mixed.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Data/Array/Mixed.hs') diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs index 246f8fc..e7d2b69 100644 --- a/src/Data/Array/Mixed.hs +++ b/src/Data/Array/Mixed.hs @@ -360,3 +360,6 @@ fromList ssh l error $ "Data.Array.Mixed.fromList: length of list (" ++ show (length l) ++ ")" ++ "does not match the type (" ++ show (natVal m) ++ ")" _ -> XArray (S.ravel (ORB.fromList [length l] (coerce @[XArray sh a] @[S.Array (FromINat (Rank sh)) a] l))) + +toList :: Storable a => XArray (n : sh) a -> [XArray sh a] +toList (XArray arr) = coerce (ORB.toList (S.unravel arr)) -- cgit v1.2.3-70-g09d2