aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-04-20 22:52:44 +0200
committerTom Smeding <tom@tomsmeding.com>2024-04-20 22:52:44 +0200
commit2f5bf6144411c9e94b1ca013c1ef549ed06a5529 (patch)
tree9121a18c0bfed6b561431da40889057955f49c6f /src/Data/Array/Nested/Internal.hs
parenta3149a6e039516e984f745cd6260ce95bf80dee4 (diff)
Small cleanup
Diffstat (limited to 'src/Data/Array/Nested/Internal.hs')
-rw-r--r--src/Data/Array/Nested/Internal.hs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs
index 4e78647..bf408e6 100644
--- a/src/Data/Array/Nested/Internal.hs
+++ b/src/Data/Array/Nested/Internal.hs
@@ -941,6 +941,11 @@ rfromVector sh v
| Dict <- lemKnownReplicate (Proxy @n)
= Ranked (mfromVector (ixCvtRX sh) v)
+rfromList :: forall n a. (KnownINat n, Elt a) => NonEmpty (Ranked n a) -> Ranked (S n) a
+rfromList l
+ | Dict <- lemKnownReplicate (Proxy @n)
+ = Ranked (mfromList ((\(Ranked x) -> x) <$> l))
+
rfromList1 :: Elt a => NonEmpty a -> Ranked I1 a
rfromList1 = Ranked . mfromList . fmap mscalar
@@ -965,11 +970,6 @@ rconstant sh x = coerce (rconstantP sh x)
rslice :: (KnownINat n, Elt a) => [(Int, Int)] -> Ranked n a -> Ranked n a
rslice ivs = rlift $ \_ -> X.slice ivs
-rfromList :: forall n a. (KnownINat n, Elt a) => NonEmpty (Ranked n a) -> Ranked (S n) a
-rfromList l
- | Dict <- lemKnownReplicate (Proxy @n)
- = Ranked (mfromList ((\(Ranked x) -> x) <$> l))
-
-- ====== API OF SHAPED ARRAYS ====== --
@@ -1086,6 +1086,12 @@ sfromVector v
| Dict <- lemKnownMapJust (Proxy @sh)
= Shaped (mfromVector (ixCvtSX (cvtSShapeIxS (knownShape @sh))) v)
+sfromList :: forall n sh a. (KnownNat n, KnownShape sh, Elt a)
+ => NonEmpty (Shaped sh a) -> Shaped (n : sh) a
+sfromList l
+ | Dict <- lemKnownMapJust (Proxy @sh)
+ = Shaped (mfromList ((\(Shaped x) -> x) <$> l))
+
sfromList1 :: (KnownNat n, Elt a) => NonEmpty a -> Shaped '[n] a
sfromList1 = Shaped . mfromList . fmap mscalar
@@ -1109,9 +1115,3 @@ sconstant x = coerce (sconstantP @sh x)
sslice :: (KnownShape sh, Elt a) => [(Int, Int)] -> Shaped sh a -> Shaped sh a
sslice ivs = slift $ \_ -> X.slice ivs
-
-sfromList :: forall n sh a. (KnownNat n, KnownShape sh, Elt a)
- => NonEmpty (Shaped sh a) -> Shaped (n : sh) a
-sfromList l
- | Dict <- lemKnownMapJust (Proxy @sh)
- = Shaped (mfromList ((\(Shaped x) -> x) <$> l))