aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-02 22:52:16 +0100
committerMikolaj Konarski <mikolaj.konarski@funktory.com>2025-12-02 22:54:42 +0100
commit558827a5a3d0e431d31c754e70bfb0daec5f5e9b (patch)
treeae9c4aceb7cd232a26afa95a3c7bb4d09432f3e0
parent466b05b8ec4e8f07b46ebdfaaacb8fdaca82d207 (diff)
Make shsFromList even more const-likeHEADmaster
-rw-r--r--src/Data/Array/Nested/Shaped/Shape.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Data/Array/Nested/Shaped/Shape.hs b/src/Data/Array/Nested/Shaped/Shape.hs
index 60800ae..0d90e91 100644
--- a/src/Data/Array/Nested/Shaped/Shape.hs
+++ b/src/Data/Array/Nested/Shaped/Shape.hs
@@ -362,12 +362,12 @@ shsSize (n :$$ sh) = fromSNat' n * shsSize sh
-- | This is a partial @const@ that fails when the second argument
-- doesn't match the first.
shsFromList :: ShS sh -> [Int] -> ShS sh
-shsFromList topsh topl = go topsh topl
+shsFromList topsh topl = go topsh topl `seq` topsh
where
- go :: ShS sh' -> [Int] -> ShS sh'
- go sh0@ZSS [] = sh0
- go sh0@(sn :$$ sh) (i : is)
- | i == fromSNat' sn = go sh is `seq` sh0
+ go :: ShS sh' -> [Int] -> ()
+ go ZSS [] = ()
+ go (sn :$$ sh) (i : is)
+ | i == fromSNat' sn = go sh is
| otherwise = error $ "shsFromList: Value does not match typing (type says "
++ show (fromSNat' sn) ++ ", list contains " ++ show i ++ ")"
go _ _ = error $ "shsFromList: Mismatched list length (type says "