From 31eff15c7f8f062748cda6c7b86c5b38818d9035 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Tue, 13 May 2025 16:37:23 +0200 Subject: Add a couple of new zip operations that obviously make sense --- src/Data/Array/Nested/Internal/Shape.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Data/Array/Nested/Internal/Shape.hs') diff --git a/src/Data/Array/Nested/Internal/Shape.hs b/src/Data/Array/Nested/Internal/Shape.hs index 82b7966..490c9a8 100644 --- a/src/Data/Array/Nested/Internal/Shape.hs +++ b/src/Data/Array/Nested/Internal/Shape.hs @@ -333,6 +333,12 @@ shrLast (ShR list) = listrLast list shrAppend :: forall n m i. ShR n i -> ShR m i -> ShR (n + m) i shrAppend = coerce (listrAppend @_ @i) +shrZip :: ShR n i -> ShR n j -> ShR n (i, j) +shrZip (ShR l1) (ShR l2) = ShR $ listrZip l1 l2 + +shrZipWith :: (i -> j -> k) -> ShR n i -> ShR n j -> ShR n k +shrZipWith f (ShR l1) (ShR l2) = ShR $ listrZipWith f l1 l2 + shrPermutePrefix :: forall n i. [Int] -> ShR n i -> ShR n i shrPermutePrefix = coerce (listrPermutePrefix @i) -- cgit v1.2.3-70-g09d2