aboutsummaryrefslogtreecommitdiff
path: root/src/Data/Array/Mixed.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-17 12:59:02 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-17 12:59:02 +0200
commit03879dfc925510c13c46664ca3438cc1d4872048 (patch)
tree97287dab5cea171c4a7c681d8fee2ba139538f48 /src/Data/Array/Mixed.hs
parent2ebf15f4085f633fc2f22c05684391aa9d1c4cd9 (diff)
PermutePrefix abbreviation
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))