From 03879dfc925510c13c46664ca3438cc1d4872048 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 17 May 2024 12:59:02 +0200 Subject: PermutePrefix abbreviation --- src/Data/Array/Mixed.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Data/Array/Mixed.hs') 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)) -- cgit v1.2.3-70-g09d2