diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-10-10 22:33:21 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-10-10 22:33:21 +0200 |
commit | 62d0b4a515e807e15e8438fbe2f9ee87ccf5d911 (patch) | |
tree | b3775510561d2919f55de8ff108e44b9670ce0b5 /src/Data/Array/Nested/Internal/Shape.hs | |
parent | 7ea4ab011d0c63b0f284ae20f780fe8675a2d90c (diff) |
Better error message in IsList(ListR)
Diffstat (limited to 'src/Data/Array/Nested/Internal/Shape.hs')
-rw-r--r-- | src/Data/Array/Nested/Internal/Shape.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Data/Array/Nested/Internal/Shape.hs b/src/Data/Array/Nested/Internal/Shape.hs index a7797a7..b7bbf4c 100644 --- a/src/Data/Array/Nested/Internal/Shape.hs +++ b/src/Data/Array/Nested/Internal/Shape.hs @@ -273,12 +273,14 @@ shrPermutePrefix = coerce (listrPermutePrefix @i) -- | Untyped: length is checked at runtime. instance KnownNat n => IsList (ListR n i) where type Item (ListR n i) = i - fromList = go (SNat @n) + fromList topl = go (SNat @n) topl where go :: SNat n' -> [i] -> ListR n' i go SZ [] = ZR go (SS n) (i : is) = i ::: go n is - go _ _ = error "IsList(ListR): Mismatched list length" + go _ _ = error $ "IsList(ListR): Mismatched list length (type says " + ++ show (fromSNat (SNat @n)) ++ ", list has length " + ++ show (length topl) ++ ")" toList = Foldable.toList -- | Untyped: length is checked at runtime. |