aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal/Ranked.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/Ranked.hs
parent87484b9adcbaa6b380ed3ba1a499bd227a8863a8 (diff)
Add *flatten
Diffstat (limited to 'src/Data/Array/Nested/Internal/Ranked.hs')
-rw-r--r--src/Data/Array/Nested/Internal/Ranked.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs
index 3e9f528..59c1820 100644
--- a/src/Data/Array/Nested/Internal/Ranked.hs
+++ b/src/Data/Array/Nested/Internal/Ranked.hs
@@ -446,6 +446,9 @@ rreshape sh' rarr@(Ranked arr)
, Dict <- lemKnownReplicate (shrLengthSNat sh')
= Ranked (mreshape (shCvtRX sh') arr)
+rflatten :: Elt a => Ranked n a -> Ranked 1 a
+rflatten (Ranked arr) = mtoRanked (mflatten arr)
+
riota :: (Enum a, PrimElt a, Elt a) => Int -> Ranked 1 a
riota n = TN.withSomeSNat (fromIntegral n) $ mtoRanked . miota