aboutsummaryrefslogtreecommitdiff
path: root/src/Data
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-05-19 16:59:25 +0200
committerTom Smeding <tom@tomsmeding.com>2024-05-19 16:59:25 +0200
commit2bfd35243211d2acbc35629d448d27a51a9112bc (patch)
tree805d468b50897bddc4bb9ec8163664f418f64959 /src/Data
parent01cc25516e6c641d1d5c889f20d92fb787f93c11 (diff)
Fix some fromLists
Diffstat (limited to 'src/Data')
-rw-r--r--src/Data/Array/Mixed.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Data/Array/Mixed.hs b/src/Data/Array/Mixed.hs
index 398a3de..fa61b01 100644
--- a/src/Data/Array/Mixed.hs
+++ b/src/Data/Array/Mixed.hs
@@ -243,9 +243,8 @@ instance KnownShX sh => IsList (ListX sh (Const i)) where
go ZKX [] = ZX
go (_ :!% sh) (i : is) = Const i ::% go sh is
go _ _ = error $ "IsList(ListX): Mismatched list length (type says "
- ++ show typelen ++ ", list has length "
+ ++ show (lengthStaticShX (knownShX @sh)) ++ ", list has length "
++ show (length topl) ++ ")"
- where typelen = let StaticShX l = knownShX @sh in lengthListX l
toList = go
where
go :: ListX sh' (Const i) -> [i]
@@ -261,7 +260,7 @@ instance KnownShX sh => IsList (IxX sh i) where
-- | Untyped: length and known dimensions are checked (at runtime).
instance KnownShX sh => IsList (ShX sh Int) where
type Item (ShX sh Int) = Int
- fromList = ShX . go (knownShX @sh)
+ fromList topl = ShX (go (knownShX @sh) topl)
where
go :: StaticShX sh' -> [Int] -> ListX sh' (SMayNat Int SNat)
go ZKX [] = ZX
@@ -270,7 +269,9 @@ instance KnownShX sh => IsList (ShX sh Int) where
| otherwise = error $ "IsList(ShX): Value does not match typing (type says "
++ show (fromSNat' sn) ++ ", list contains " ++ show i ++ ")"
go (SUnknown () :!% sh) (i : is) = SUnknown i ::% go sh is
- go _ _ = error "IsList(ShX): Mismatched list length"
+ go _ _ = error $ "IsList(ShX): Mismatched list length (type says "
+ ++ show (lengthStaticShX (knownShX @sh)) ++ ", list has length "
+ ++ show (length topl) ++ ")"
toList = go
where
go :: ShX sh' Int -> [Int]