diff options
Diffstat (limited to 'src/Data/Array/Mixed/XArray.hs')
-rw-r--r-- | src/Data/Array/Mixed/XArray.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Data/Array/Mixed/XArray.hs b/src/Data/Array/Mixed/XArray.hs index e93ffca..20f5c7a 100644 --- a/src/Data/Array/Mixed/XArray.hs +++ b/src/Data/Array/Mixed/XArray.hs @@ -18,7 +18,9 @@ import Control.DeepSeq (NFData(..)) import Data.Array.Ranked qualified as ORB import Data.Array.RankedS qualified as S import Data.Coerce +import Data.Foldable (toList) import Data.Kind +import Data.List.NonEmpty (NonEmpty) import Data.Proxy import Data.Type.Equality import Data.Type.Ord @@ -117,6 +119,14 @@ append ssh (XArray a) (XArray b) | Dict <- lemKnownNatRankSSX ssh = XArray (S.append a b) +-- | All arrays must have the same shape, except possibly for the outermost +-- dimension. +concat :: Storable a + => StaticShX sh -> NonEmpty (XArray (Nothing : sh) a) -> XArray (Nothing : sh) a +concat ssh l + | Dict <- lemKnownNatRankSSX ssh + = XArray (S.concatOuter (coerce (toList l))) + -- | If the prefix of the shape of the input array (@sh@) is empty (i.e. -- contains a zero), then there is no way to deduce the full shape of the output -- array (more precisely, the @sh2@ part): that could only come from calling |