
12 Feb
2008
12 Feb
'08
1:50 a.m.
On Feb 11, 2008 10:18 PM, Uwe Hollerbach
If I fire up ghci, import Data.Ratio and GHC.Real, and then ask about the type of "infinity", it tells me Rational, which as far as I can tell is Ratio Integer...?
Yes, Rational is Ratio Integer. It might not be a good idea to import GHC.Real, since it doesn't seem to be documented at http://www.haskell.org/ghc/docs/latest/html/libraries/. If you just import Data.Ratio, and define
pinf :: Integer pinf = 1 % 0
ninf :: Integer ninf = (-1) % 0
Then things fail the way you expect (basically, Data.Ratio isn't written to support infinity). But it's really odd the way the infinity from GHC.Real works. Anyone have an explanation? -- I'm doing Science and I'm still alive.