aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Nested/Internal/Ranked.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Nested/Internal/Ranked.hs')
-rw-r--r--src/Data/Array/Nested/Internal/Ranked.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Data/Array/Nested/Internal/Ranked.hs b/src/Data/Array/Nested/Internal/Ranked.hs
index 9383b08..3e911ac 100644
--- a/src/Data/Array/Nested/Internal/Ranked.hs
+++ b/src/Data/Array/Nested/Internal/Ranked.hs
@@ -18,7 +18,7 @@
{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-}
module Data.Array.Nested.Internal.Ranked where
-import Prelude hiding (mappend)
+import Prelude hiding (mappend, mconcat)
import Control.DeepSeq (NFData)
import Control.Monad.ST
@@ -109,6 +109,8 @@ instance Elt a => Elt (Ranked n a) where
mtranspose perm (M_Ranked arr) = M_Ranked (mtranspose perm arr)
+ mconcat l = M_Ranked (mconcat (coerce l))
+
type ShapeTree (Ranked n a) = (IShR n, ShapeTree a)
mshapeTree (Ranked arr) = first shCvtXR' (mshapeTree arr)
@@ -272,6 +274,11 @@ rtranspose perm arr
| otherwise
= error "Data.Array.Nested.rtranspose: Permutation longer than rank of array"
+rconcat :: forall n a. Elt a => NonEmpty (Ranked (n + 1) a) -> Ranked (n + 1) a
+rconcat
+ | Refl <- lemReplicateSucc @(Nothing @Nat) @n
+ = coerce mconcat
+
rappend :: forall n a. Elt a
=> Ranked (n + 1) a -> Ranked (n + 1) a -> Ranked (n + 1) a
rappend arr1 arr2