X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FArr.lhs;fp=GHC%2FArr.lhs;h=7dd0e90f78c853977113b9c448d5febbfb17ae7f;hb=9cac65ea790d47f5ad32da0695a5c85ee788cbba;hp=dbd7975218b9714ef2d3c1c56f0e66670ad9822b;hpb=811bf3ff4977e169901d81695f1f2340ce3dcb80;p=ghc-base.git diff --git a/GHC/Arr.lhs b/GHC/Arr.lhs index dbd7975..7dd0e90 100644 --- a/GHC/Arr.lhs +++ b/GHC/Arr.lhs @@ -435,10 +435,11 @@ safeRangeSize (l,u) = let r = rangeSize (l, u) {-# INLINE safeIndex #-} safeIndex :: Ix i => (i, i) -> Int -> i -> Int -safeIndex (l,u) n i = let i' = unsafeIndex (l,u) i +safeIndex (l,u) n i = let i' = index (l,u) i in if (0 <= i') && (i' < n) then i' - else error "Error in array index" + else error ("Error in array index; " ++ show i' ++ + " not in range [0.." ++ show n ++ ")") {-# INLINE unsafeAt #-} unsafeAt :: Ix i => Array i e -> Int -> e