From: sof Date: Sun, 18 May 1997 04:06:57 +0000 (+0000) Subject: [project @ 1997-05-18 04:06:57 by sof] X-Git-Tag: Approximately_1000_patches_recorded~688 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=41eb280cd98799cfcac67ae196631a0cd473ac7b;p=ghc-hetmet.git [project @ 1997-05-18 04:06:57 by sof] rangeSize copes with empty intervals --- 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}