diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-10-02 14:12:15 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-10-02 14:12:15 +0200 |
commit | 2018dc3476c1a1b723f8c7106d628bd0da8cb49c (patch) | |
tree | 12255ef1856abc5a7f618c0190a073a5655319bc /src/Data/Array/Nested/Ranked/Shape.hs | |
parent | ef72e54cf6bcee7124058364fea15b4d1bd62cd7 (diff) |
Diffstat (limited to 'src/Data/Array/Nested/Ranked/Shape.hs')
-rw-r--r-- | src/Data/Array/Nested/Ranked/Shape.hs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/Data/Array/Nested/Ranked/Shape.hs b/src/Data/Array/Nested/Ranked/Shape.hs index 88a550c..488b4d8 100644 --- a/src/Data/Array/Nested/Ranked/Shape.hs +++ b/src/Data/Array/Nested/Ranked/Shape.hs @@ -115,21 +115,17 @@ listrFromList (x : xs) k = listrFromList xs $ \l -> k (x ::: l) listrHead :: ListR (n + 1) i -> i listrHead (i ::: _) = i -listrHead ZR = error "unreachable" listrTail :: ListR (n + 1) i -> ListR n i listrTail (_ ::: sh) = sh -listrTail ZR = error "unreachable" listrInit :: ListR (n + 1) i -> ListR n i listrInit (n ::: sh@(_ ::: _)) = n ::: listrInit sh listrInit (_ ::: ZR) = ZR -listrInit ZR = error "unreachable" listrLast :: ListR (n + 1) i -> i listrLast (_ ::: sh@(_ ::: _)) = listrLast sh listrLast (n ::: ZR) = n -listrLast ZR = error "unreachable" -- | Performs a runtime check that the lengths are identical. listrCast :: SNat n' -> ListR n i -> ListR n' i @@ -138,6 +134,7 @@ listrCast = listrCastWithName "listrCast" listrIndex :: forall k n i. (k + 1 <= n) => SNat k -> ListR n i -> i listrIndex SZ (x ::: _) = x listrIndex (SS i) (_ ::: xs) | Refl <- lemLeqSuccSucc (Proxy @k) (Proxy @n) = listrIndex i xs +listrIndex _ ZR = error "k + 1 <= 0" listrZip :: ListR n i -> ListR n j -> ListR n (i, j) listrZip ZR ZR = ZR |