From 62d0b4a515e807e15e8438fbe2f9ee87ccf5d911 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 10 Oct 2024 22:33:21 +0200 Subject: Better error message in IsList(ListR) --- src/Data/Array/Nested/Internal/Shape.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') 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. -- cgit v1.2.3-70-g09d2