aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Mixed.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-04-20 22:42:30 +0200
committerTom Smeding <tom@tomsmeding.com>2024-04-20 22:42:30 +0200
commitde1250a6837cc3b8cf168905e360845e9082c7d2 (patch)
tree7a8fb711f39f1fd0d8d4cc4e7d3b9ad24c75ed16 /src/Data/Array/Mixed.hs
parent2b0391b9a5885af1b551c83f2dc4b8ef2b48d7bf (diff)
toList
Diffstat (limited to 'src/Data/Array/Mixed.hs')
-rw-r--r--src/Data/Array/Mixed.hs3
1 files changed, 3 insertions, 0 deletions
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))