@@ -125,7 +125,7 @@ toVector (A sh t) = toVectorT sh t
125125-- O(n) time.
126126{-# INLINE fromList #-}
127127fromList :: (HasCallStack , Vector v , VecElem v a ) => ShapeL -> [a ] -> Array v a
128- fromList ss vs | n /= l = error $ " fromList: size mismatch" ++ show (n, l)
128+ fromList ss vs | n /= l = error $ " fromList: size mismatch " ++ show (n, l)
129129 | otherwise = A ss $ T st 0 $ vFromList vs
130130 where n : st = getStridesT ss
131131 l = length vs
@@ -135,7 +135,7 @@ fromList ss vs | n /= l = error $ "fromList: size mismatch" ++ show (n, l)
135135-- O(1) time.
136136{-# INLINE fromVector #-}
137137fromVector :: (HasCallStack , Vector v , VecElem v a ) => ShapeL -> v a -> Array v a
138- fromVector ss v | n /= l = error $ " fromList: size mismatch" ++ show (n, l)
138+ fromVector ss v | n /= l = error $ " fromList: size mismatch " ++ show (n, l)
139139 | otherwise = A ss $ T st 0 v
140140 where n : st = getStridesT ss
141141 l = vLength v
@@ -211,31 +211,31 @@ mapA f (A s t) = A s (mapT s f t)
211211zipWithA :: (HasCallStack , Vector v , VecElem v a , VecElem v b , VecElem v c ) =>
212212 (a -> b -> c ) -> Array v a -> Array v b -> Array v c
213213zipWithA f (A s t) (A s' t') | s == s' = A s (zipWithT s f t t')
214- | otherwise = error $ " zipWithA: shape mismatch: " ++ show (s, s')
214+ | otherwise = error $ " zipWithA: shape mismatch " ++ show (s, s')
215215
216216-- | Map over the array elements.
217217-- O(n) time.
218218{-# INLINE zipWith3A #-}
219219zipWith3A :: (HasCallStack , Vector v , VecElem v a , VecElem v b , VecElem v c , VecElem v d ) =>
220220 (a -> b -> c -> d ) -> Array v a -> Array v b -> Array v c -> Array v d
221221zipWith3A f (A s t) (A s' t') (A s'' t'') | s == s' && s == s'' = A s (zipWith3T s f t t' t'')
222- | otherwise = error $ " zipWith3A: shape mismatch: " ++ show (s, s', s'')
222+ | otherwise = error $ " zipWith3A: shape mismatch " ++ show (s, s', s'')
223223
224224-- | Map over the array elements.
225225-- O(n) time.
226226{-# INLINE zipWith4A #-}
227227zipWith4A :: (HasCallStack , Vector v , VecElem v a , VecElem v b , VecElem v c , VecElem v d , VecElem v e ) =>
228228 (a -> b -> c -> d -> e ) -> Array v a -> Array v b -> Array v c -> Array v d -> Array v e
229229zipWith4A f (A s t) (A s' t') (A s'' t'') (A s''' t''') | s == s' && s == s'' && s == s''' = A s (zipWith4T s f t t' t'' t''')
230- | otherwise = error $ " zipWith4A: shape mismatch: " ++ show (s, s', s'', s''')
230+ | otherwise = error $ " zipWith4A: shape mismatch " ++ show (s, s', s'', s''')
231231
232232-- | Map over the array elements.
233233-- O(n) time.
234234{-# INLINE zipWith5A #-}
235235zipWith5A :: (HasCallStack , Vector v , VecElem v a , VecElem v b , VecElem v c , VecElem v d , VecElem v e , VecElem v f ) =>
236236 (a -> b -> c -> d -> e -> f ) -> Array v a -> Array v b -> Array v c -> Array v d -> Array v e -> Array v f
237237zipWith5A f (A s t) (A s' t') (A s'' t'') (A s''' t''') (A s'''' t'''') | s == s' && s == s'' && s == s''' && s == s'''' = A s (zipWith5T s f t t' t'' t''' t'''')
238- | otherwise = error $ " zipWith5A: shape mismatch: " ++ show (s, s', s'', s''', s'''')
238+ | otherwise = error $ " zipWith5A: shape mismatch " ++ show (s, s', s'', s''', s'''')
239239
240240-- | Pad each dimension on the low and high side with the given value.
241241-- O(n) time.
@@ -317,9 +317,9 @@ window :: (HasCallStack, Vector v) => [Int] -> Array v a -> Array v a
317317window aws (A ash (T ss o v)) = A (win aws ash) (T (ss' ++ ss) o v)
318318 where ss' = zipWith const ss aws
319319 win (w: ws) (s: sh) | w <= s = s - w + 1 : win ws sh
320- | otherwise = error $ " window: bad window size : " ++ show (w, s)
320+ | otherwise = error $ " window: bad window size " ++ show (w, s)
321321 win [] sh = aws ++ sh
322- win _ _ = error $ " window: rank mismatch: " ++ show (aws, ash)
322+ win _ _ = error $ " window: rank mismatch " ++ show (aws, ash)
323323
324324-- | Stride the outermost dimensions.
325325-- E.g., if the array shape is @[10,12,8]@ and the strides are
@@ -331,7 +331,7 @@ stride :: (HasCallStack, Vector v) => [Int] -> Array v a -> Array v a
331331stride ats (A ash (T ss o v)) = A (str ats ash) (T (zipWith (*) (ats ++ repeat 1 ) ss) o v)
332332 where str (t: ts) (s: sh) = (s+ t- 1 ) `quot` t : str ts sh
333333 str [] sh = sh
334- str _ _ = error $ " stride: rank mismatch: " ++ show (ats, ash)
334+ str _ _ = error $ " stride: rank mismatch " ++ show (ats, ash)
335335
336336-- | Rotate the array k times along the d'th dimension.
337337-- E.g., if the array shape is @[2, 3, 2]@, d is 1, and k is 4,
@@ -496,7 +496,7 @@ broadcast ds sh a | length ds /= rank a = error "broadcast: wrong number of broa
496496update :: (HasCallStack , Vector v , VecElem v a ) =>
497497 Array v a -> [([Int ], a )] -> Array v a
498498update (A sh t) us | all (ok . fst ) us = A sh $ updateT sh t us
499- | otherwise = error $ " update: index out of bounds " ++ show (filter (not . ok) $ map fst us)
499+ | otherwise = error $ " update: index out of bounds: " ++ show (filter (not . ok) $ map fst us)
500500 where ok is = length is == r && and (zipWith (\ i s -> 0 <= i && i < s) is sh)
501501 r = length sh
502502
0 commit comments