aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Mixed.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Array/Mixed.hs')
-rw-r--r--src/Data/Array/Mixed.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs
index 856e6cb..5fbc46f 100644
--- a/src/Data/Array/Mixed.hs
+++ b/src/Data/Array/Mixed.hs
@@ -418,6 +418,8 @@ type family Permute is sh where
Permute '[] sh = '[]
Permute (i : is) sh = Index i sh : Permute is sh
+type PermutePrefix is sh = Permute is (TakeLen is sh) ++ DropLen is sh
+
data HList f list where
HNil :: HList f '[]
HCons :: f a -> HList f l -> HList f (a : l)
@@ -486,7 +488,7 @@ ssxIndex _ _ _ ZKSX _ = error "Index into empty shape"
transpose :: forall is sh a. (Permutation is, Rank is <= Rank sh, KnownShapeX sh)
=> HList SNat is
-> XArray sh a
- -> XArray (Permute is (TakeLen is sh) ++ DropLen is sh) a
+ -> XArray (PermutePrefix is sh) a
transpose perm (XArray arr)
| Dict <- lemKnownNatRankSSX (knownShapeX @sh)
, Refl <- lemRankApp (ssxPermute perm (ssxTakeLen perm (knownShapeX @sh))) (ssxDropLen perm (knownShapeX @sh))