From 41eb280cd98799cfcac67ae196631a0cd473ac7b Mon Sep 17 00:00:00 2001 From: sof Date: Sun, 18 May 1997 04:06:57 +0000 Subject: [PATCH] [project @ 1997-05-18 04:06:57 by sof] rangeSize copes with empty intervals --- ghc/lib/required/Ix.lhs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ghc/lib/required/Ix.lhs b/ghc/lib/required/Ix.lhs index afafe24..0da9e1a 100644 --- a/ghc/lib/required/Ix.lhs +++ b/ghc/lib/required/Ix.lhs @@ -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} -- 1.7.10.4