From 065461c56fb41dd24450f35d2d31fc0914129ff9 Mon Sep 17 00:00:00 2001 From: Mikolaj Konarski Date: Wed, 22 May 2024 17:22:28 +0200 Subject: [PATCH] Fix and tweak the display of rank errors --- Data/Array/Internal/RankedG.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Array/Internal/RankedG.hs b/Data/Array/Internal/RankedG.hs index 7bc5bfc..f7277ac 100644 --- a/Data/Array/Internal/RankedG.hs +++ b/Data/Array/Internal/RankedG.hs @@ -172,7 +172,7 @@ reshape :: forall n n' v a . (HasCallStack,Vector v, VecElem v a, KnownNat n, Kn ShapeL -> Array n v a -> Array n' v a reshape sh (A sh' t@(T ost oo v)) | n /= n' = error $ "reshape: size mismatch " ++ show (sh, sh') - | length sh /= valueOf @n' = error $ "reshape: rank mismatch " ++ show (length sh, valueOf @n :: Int) + | length sh /= valueOf @n' = error $ "reshape: rank mismatch " ++ show (length sh, valueOf @n' :: Int) | vLength v == 1 = A sh $ T (map (const 0) sh) 0 v -- Fast special case for singleton vector | Just nst <- simpleReshape ost sh' sh = A sh $ T nst oo v | otherwise = A sh $ T st 0 $ toVectorT sh' t @@ -322,7 +322,7 @@ unravel = rerank @1 scalar {-# INLINE window #-} window :: forall n n' v a . (Vector v, KnownNat n, KnownNat n') => [Int] -> Array n v a -> Array n' v a -window aws _ | valueOf @n' /= length aws + valueOf @n = error $ "window: rank mismatch: " ++ show (valueOf @n :: Int, length aws, valueOf @n' :: Int) +window aws _ | valueOf @n' /= length aws + valueOf @n = error $ "window: rank mismatch: " ++ show (valueOf @n' :: Int, length aws, valueOf @n :: Int) window aws (A ash (T ss o v)) = A (win aws ash) (T (ss' ++ ss) o v) where ss' = zipWith const ss aws win (w:ws) (s:sh) | w <= s = s - w + 1 : win ws sh