aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Internal.hs')
-rw-r--r--src/Data/Array/Nested/Internal.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs
index f76b2ab..6f0cfc8 100644
--- a/src/Data/Array/Nested/Internal.hs
+++ b/src/Data/Array/Nested/Internal.hs
@@ -489,6 +489,9 @@ mfromVector sh v
| otherwise =
M_Primitive (X.fromVector sh v)
+mfromList1 :: (KnownShapeX '[n], Elt a) => NonEmpty a -> Mixed '[n] a
+mfromList1 = mfromList . fmap mscalar
+
munScalar :: Elt a => Mixed '[] a -> a
munScalar arr = mindex arr IZX
@@ -918,6 +921,9 @@ rfromVector sh v
| Dict <- lemKnownReplicate (Proxy @n)
= Ranked (mfromVector (ixCvtRX sh) v)
+rfromList1 :: Elt a => NonEmpty a -> Ranked I1 a
+rfromList1 = Ranked . mfromList . fmap mscalar
+
runScalar :: Elt a => Ranked I0 a -> a
runScalar arr = rindex arr IZR
@@ -1051,6 +1057,9 @@ sfromVector v
| Dict <- lemKnownMapJust (Proxy @sh)
= Shaped (mfromVector (ixCvtSX (cvtSShapeIxS (knownShape @sh))) v)
+sfromList1 :: (KnownNat n, Elt a) => NonEmpty a -> Shaped '[n] a
+sfromList1 = Shaped . mfromList . fmap mscalar
+
sunScalar :: Elt a => Shaped '[] a -> a
sunScalar arr = sindex arr IZS