[project @ 2002-06-09 14:20:06 by panne]
authorpanne <unknown>
Sun, 9 Jun 2002 14:20:06 +0000 (14:20 +0000)
committerpanne <unknown>
Sun, 9 Jun 2002 14:20:06 +0000 (14:20 +0000)
Use :%, not % for Inf/NaN, the latter would immediately lead to a
runtime error. Note that

   isInfinite (read "Infinity" :: Float)

or

   isInfinite (fromRational (1 :% 0))

still don't work, because fromRational is not OK for those cases.

Text/Read/Lex.hs

index 9dfd361..290072b 100644 (file)
@@ -35,7 +35,7 @@ import GHC.Num( Num(..), Integer )
 import GHC.Show( Show(.. ), showChar, showString,
                 isSpace, isAlpha, isAlphaNum,
                 isOctDigit, isHexDigit, toUpper )
-import GHC.Real( Ratio, Integral, Rational, (%), fromIntegral, fromRational, 
+import GHC.Real( Ratio(..), Integral, Rational, (%), fromIntegral, fromRational, 
                 toInteger, (^), (^^) )
 import GHC.Float( Float, Double )
 import GHC.List
@@ -285,8 +285,8 @@ lexString =
 --  Lexing numbers
 
 infinity, notANumber :: Rational
-infinity   = 1 % 0
-notANumber = 0 % 0
+infinity   = 1 :% 0
+notANumber = 0 :% 0
 
 type Base   = Int
 type Digits = [Int]