From: simonpj Date: Wed, 12 Oct 2005 10:57:40 +0000 (+0000) Subject: [project @ 2005-10-12 10:57:40 by simonpj] X-Git-Tag: cmm-merge2~15 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1e6ad7ab1d081f69cfb09eac24f2a47536080fff;p=haskell-directory.git [project @ 2005-10-12 10:57:40 by simonpj] Comments --- diff --git a/GHC/Arr.lhs b/GHC/Arr.lhs index c5e945f..0b29db0 100644 --- a/GHC/Arr.lhs +++ b/GHC/Arr.lhs @@ -75,12 +75,16 @@ class (Ord a) => Ix a where unsafeRangeSize :: (a,a) -> Int -- Must specify one of index, unsafeIndex - index b i | inRange b i = unsafeIndex b i + index b i | inRange b i = unsafeIndex b i | otherwise = error "Error in array index" unsafeIndex b i = index b i rangeSize b@(_l,h) | inRange b h = unsafeIndex b h + 1 - | otherwise = 0 + | otherwise = 0 -- This case is only here to + -- check for an empty range + -- NB: replacing (inRange b h) by (l <= h) fails for + -- tuples. E.g. (1,2) <= (2,1) but the range is empty + unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1 \end{code}