From f32fdfbe16ba5510e141d8540627b40e01dc49f5 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Tue, 10 Feb 2026 11:48:45 +0100 Subject: Add mtoListPrimLinear and friends --- src/Data/Array/Nested/Shaped.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/Data/Array/Nested/Shaped.hs') 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))))) -- cgit v1.2.3-70-g09d2