From a25d4061e219cec153f066fddbf710abd63b5e48 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 3 Jun 2024 19:56:05 +0200 Subject: Move sh*Tail to main ox-arrays --- src/Data/Array/Mixed/Shape.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Data/Array/Mixed') diff --git a/src/Data/Array/Mixed/Shape.hs b/src/Data/Array/Mixed/Shape.hs index a13a176..4ab3c26 100644 --- a/src/Data/Array/Mixed/Shape.hs +++ b/src/Data/Array/Mixed/Shape.hs @@ -96,6 +96,9 @@ listxToList :: ListX sh' (Const i) -> [i] listxToList ZX = [] listxToList (Const i ::% is) = i : listxToList is +listxTail :: ListX (n : sh) i -> ListX sh i +listxTail (_ ::% sh) = sh + listxAppend :: ListX sh f -> ListX sh' f -> ListX (sh ++ sh') f listxAppend ZX idx' = idx' listxAppend (i ::% idx) idx' = i ::% listxAppend idx idx' @@ -147,6 +150,9 @@ ixxZero' :: IShX sh -> IIxX sh ixxZero' ZSX = ZIX ixxZero' (_ :$% sh) = 0 :.% ixxZero' sh +ixxTail :: IxX (n : sh) i -> IxX sh i +ixxTail (IxX list) = IxX (listxTail list) + ixxAppend :: forall sh sh' i. IxX sh i -> IxX sh' i -> IxX (sh ++ sh') i ixxAppend = coerce (listxAppend @_ @(Const i)) @@ -273,7 +279,7 @@ shxAppend :: forall sh sh' i. ShX sh i -> ShX sh' i -> ShX (sh ++ sh') i shxAppend = coerce (listxAppend @_ @(SMayNat i SNat)) shxTail :: ShX (n : sh) i -> ShX sh i -shxTail (_ :$% sh) = sh +shxTail (ShX list) = ShX (listxTail list) shxDropSSX :: forall sh sh' i. ShX (sh ++ sh') i -> StaticShX sh -> ShX sh' i shxDropSSX = coerce (listxDrop @(SMayNat i SNat) @(SMayNat () SNat)) -- cgit v1.2.3-70-g09d2