aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal/Mixed.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-06-10 23:28:11 +0200
committerTom Smeding <tom@tomsmeding.com>2024-06-10 23:28:11 +0200
commit5f6a64660b16d8f188caca5216e55debf4264611 (patch)
tree7e378c5929126db6c583862220e4163de7b2b3df /src/Data/Array/Nested/Internal/Mixed.hs
parent87484b9adcbaa6b380ed3ba1a499bd227a8863a8 (diff)
Add *flatten
Diffstat (limited to 'src/Data/Array/Nested/Internal/Mixed.hs')
-rw-r--r--src/Data/Array/Nested/Internal/Mixed.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal/Mixed.hs b/src/Data/Array/Nested/Internal/Mixed.hs
index 9c2096d..69df52a 100644
--- a/src/Data/Array/Nested/Internal/Mixed.hs
+++ b/src/Data/Array/Nested/Internal/Mixed.hs
@@ -796,6 +796,9 @@ mreshape sh' arr =
(\sshIn -> X.reshapePartial (ssxFromShape (mshape arr)) sshIn sh')
arr
+mflatten :: Elt a => Mixed sh a -> Mixed '[Flatten sh] a
+mflatten arr = mreshape (shxFlatten (mshape arr) :$% ZSX) arr
+
miota :: (Enum a, PrimElt a) => SNat n -> Mixed '[Just n] a
miota sn = fromPrimitive $ M_Primitive (SKnown sn :$% ZSX) (X.iota sn)