projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ccd0725
)
[project @ 2005-10-12 10:57:40 by simonpj]
author
simonpj
<unknown>
Wed, 12 Oct 2005 10:57:40 +0000
(10:57 +0000)
committer
simonpj
<unknown>
Wed, 12 Oct 2005 10:57:40 +0000
(10:57 +0000)
Comments
GHC/Arr.lhs
patch
|
blob
|
history
diff --git
a/GHC/Arr.lhs
b/GHC/Arr.lhs
index
c5e945f
..
0b29db0
100644
(file)
--- 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
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 = 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}
unsafeRangeSize b@(_l,h) = unsafeIndex b h + 1
\end{code}