diff options
-rw-r--r-- | src/Data/Array/Nested/Internal.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal.hs b/src/Data/Array/Nested/Internal.hs index 376651f..bfcb760 100644 --- a/src/Data/Array/Nested/Internal.hs +++ b/src/Data/Array/Nested/Internal.hs @@ -430,6 +430,23 @@ mconstant sh x | otherwise = coerce (M_Primitive (X.constant sh x)) +-- | All arrays in the list must have the same shape; if they do not, a runtime +-- error will be thrown. See the documentation of 'mgenerate' for more +-- information. Furthermore, the length of the list must correspond with @n@: +-- if @n@ is @Just m@ and @m@ does not equal the length of the list, a runtime +-- error is thrown. +-- mfromList :: forall n sh a. (KnownShapeX (n : sh), Elt a) => [Mixed sh a] -> Mixed (n : sh) a +-- mfromList l = +-- case knownShapeX @(n : sh) of +-- m@GHC_SNat :$@ _ +-- | length l /= fromIntegral (natVal m) -> +-- error $ "mfromList: length of list (" ++ show (length l) ++ ")" ++ +-- "does not match the type (" ++ show (natVal m) ++ ")" +-- | natVal m == 0 -> memptyArray _ +-- -- | let shapetree = mshapeTree +-- | otherwise -> _ +-- () :$? _ -> _ + mliftPrim :: (KnownShapeX sh, Storable a) => (a -> a) -> Mixed sh (Primitive a) -> Mixed sh (Primitive a) |