[project @ 1997-05-18 04:06:57 by sof]
authorsof <unknown>
Sun, 18 May 1997 04:06:57 +0000 (04:06 +0000)
committersof <unknown>
Sun, 18 May 1997 04:06:57 +0000 (04:06 +0000)
rangeSize copes with empty intervals

ghc/lib/required/Ix.lhs

index afafe24..0da9e1a 100644 (file)
@@ -161,6 +161,8 @@ in the range for an @Ix@ pair:
 
 \begin{code}
 rangeSize :: (Ix a) => (a,a) -> Int
-rangeSize b@(_,high) = index b high + 1
+rangeSize b@(l,h)
+ | l > h     = 0
+ | otherwise = index b h + 1
 
 \end{code}