diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-06-13 13:09:04 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-06-13 13:09:04 +0200 |
commit | 20173c939486ed6e27b8170e94f666d8ae3df152 (patch) | |
tree | 36c02005c3f2a20567388c6291e54bc2e4a4e6db /src/Data/Array/Mixed/Shape.hs | |
parent | 275847827d7550436eaf8cd10969f1430dae821d (diff) |
Rename *LengthSNat to *Rank
Diffstat (limited to 'src/Data/Array/Mixed/Shape.hs')
-rw-r--r-- | src/Data/Array/Mixed/Shape.hs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Data/Array/Mixed/Shape.hs b/src/Data/Array/Mixed/Shape.hs index e46105d..95cd4ef 100644 --- a/src/Data/Array/Mixed/Shape.hs +++ b/src/Data/Array/Mixed/Shape.hs @@ -81,9 +81,9 @@ listxFold f (x ::% xs) = f x <> listxFold f xs listxLength :: ListX sh f -> Int listxLength = getSum . listxFold (\_ -> Sum 1) -listxLengthSNat :: ListX sh f -> SNat (Rank sh) -listxLengthSNat ZX = SNat -listxLengthSNat (_ ::% l) | SNat <- listxLengthSNat l = SNat +listxRank :: ListX sh f -> SNat (Rank sh) +listxRank ZX = SNat +listxRank (_ ::% l) | SNat <- listxRank l = SNat listxShow :: forall sh f. (forall n. f n -> ShowS) -> ListX sh f -> ShowS listxShow f l = showString "[" . go "" l . showString "]" @@ -265,8 +265,8 @@ instance NFData i => NFData (ShX sh i) where shxLength :: ShX sh i -> Int shxLength (ShX l) = listxLength l -shxLengthSNat :: ShX sh f -> SNat (Rank sh) -shxLengthSNat (ShX list) = listxLengthSNat list +shxRank :: ShX sh f -> SNat (Rank sh) +shxRank (ShX list) = listxRank list -- | This is more than @geq@: it also checks that the integers (the unknown -- dimensions) are the same. @@ -344,10 +344,6 @@ shxEnum = \sh -> go sh id [] go ZSX f = (f ZIX :) go (n :$% sh) f = foldr (.) id [go sh (f . (i :.%)) | i <- [0 .. fromSMayNat' n - 1]] -shxRank :: ShX sh f -> SNat (Rank sh) -shxRank ZSX = SNat -shxRank (_ :$% sh) | SNat <- shxRank sh = SNat - -- * Static mixed shapes |