diff options
Diffstat (limited to 'src/Data/Array')
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 22 |
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)) |