aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Shaped.hs
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj.konarski@funktory.com>2026-02-10 11:48:45 +0100
committerMikolaj Konarski <mikolaj.konarski@funktory.com>2026-02-18 14:19:28 +0100
commitf32fdfbe16ba5510e141d8540627b40e01dc49f5 (patch)
tree2f927f1b1f16580f77d021c59f3a2947590146bb /src/Data/Array/Nested/Shaped.hs
parentd6fec1856d02e38fd64769284265bb833b57593d (diff)
Add mtoListPrimLinear and friends
Diffstat (limited to 'src/Data/Array/Nested/Shaped.hs')
-rw-r--r--src/Data/Array/Nested/Shaped.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Data/Array/Nested/Shaped.hs b/src/Data/Array/Nested/Shaped.hs
index a0addec..6034dc7 100644
--- a/src/Data/Array/Nested/Shaped.hs
+++ b/src/Data/Array/Nested/Shaped.hs
@@ -171,15 +171,21 @@ sfromList1Prim = coerce mfromList1PrimSN
sfromListPrimLinear :: forall sh a. PrimElt a => ShS sh -> [a] -> Shaped sh a
sfromListPrimLinear sh l = Shaped (mfromListPrimLinear (shxFromShS sh) l)
-stoList :: Elt a => Shaped '[n] a -> [a]
-stoList = map sunScalar . stoListOuter
-
stoListOuter :: Elt a => Shaped (n : sh) a -> [Shaped sh a]
stoListOuter (Shaped arr) = coerce (mtoListOuter arr)
+stoList :: Elt a => Shaped '[n] a -> [a]
+stoList = map sunScalar . stoListOuter
+
stoListLinear :: Elt a => Shaped sh a -> [a]
stoListLinear (Shaped arr) = mtoListLinear arr
+stoListPrim :: PrimElt a => Shaped '[n] a -> [a]
+stoListPrim (Shaped arr) = mtoListPrim arr
+
+stoListPrimLinear :: PrimElt a => Shaped sh a -> [a]
+stoListPrimLinear (Shaped arr) = mtoListPrimLinear arr
+
sfromOrthotope :: PrimElt a => ShS sh -> SS.Array sh a -> Shaped sh a
sfromOrthotope sh (SS.A (SG.A arr)) =
Shaped (fromPrimitive (M_Primitive (shxFromShS sh) (X.XArray (RS.A (RG.A (shsToList sh) arr)))))