From 52c0237fbdbc3c99ee6565ba18250360a330fb8b Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 20 May 2024 17:21:21 +0200 Subject: Rerank on primitive arrays --- src/Data/Array/Mixed.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Data/Array/Mixed.hs') diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs index 33c0dd6..2f23903 100644 --- a/src/Data/Array/Mixed.hs +++ b/src/Data/Array/Mixed.hs @@ -320,12 +320,22 @@ listxDrop long (_ ::% short) = case long of _ ::% long' -> listxDrop long' short ixDrop :: forall sh sh' i. IxX (sh ++ sh') i -> IxX sh i -> IxX sh' i ixDrop = coerce (listxDrop @(Const i) @(Const i)) +shDropSSX :: forall sh sh' i. ShX (sh ++ sh') i -> StaticShX sh -> ShX sh' i +shDropSSX = coerce (listxDrop @(SMayNat i SNat) @(SMayNat () SNat)) + shDropIx :: forall sh sh' i j. ShX (sh ++ sh') i -> IxX sh j -> ShX sh' i shDropIx = coerce (listxDrop @(SMayNat i SNat) @(Const j)) shDropSh :: forall sh sh' i. ShX (sh ++ sh') i -> ShX sh i -> ShX sh' i shDropSh = coerce (listxDrop @(SMayNat i SNat) @(SMayNat i SNat)) +shTakeSSX :: forall sh sh' i. Proxy sh' -> ShX (sh ++ sh') i -> StaticShX sh -> ShX sh i +shTakeSSX _ = flip go + where + go :: StaticShX sh1 -> ShX (sh1 ++ sh') i -> ShX sh1 i + go ZKX _ = ZSX + go (_ :!% ssh1) (n :$% sh) = n :$% go ssh1 sh + ssxDropIx :: forall sh sh' i. StaticShX (sh ++ sh') -> IxX sh i -> StaticShX sh' ssxDropIx = coerce (listxDrop @(SMayNat () SNat) @(Const i)) -- cgit v1.2.3-70-g09d2