
Amanda Clare ajc@aber.ac.uk writes:
Does anyone know how I use Rationals in ghc? In nhc I can just write
let a = b % c
But ghc-5.00.2 gives the error message "Variable not in scope: `%'"
As you noticed, you need to import Ratio to get at % -- GHC gets this right wrt the Haskell98 report. Hugs exports it from the Prelude (as does NHC, by the looks of it), which used to be right, but isn't in H98. This could be trivially fixed on the Hugs side, but I'm not sure the resulting breakage would be worth it.
Of course it would! The whole point of having a report defining Haskell 98 is that implementations should behave the same with the same programmes. If nhc had conformed to the report I don't think Amanda would have had this problem, since nhc would have reported an error from the start. (Although the report typo might have meant she would have had to ask the question, but someone would have had to spot that anyway.) Please, implementors: the fiddly little differences really are important! It's bad for the image if nothing else. Jón PS do the nhc implementors get these messages? It's more on-topic for them than for ghc-users. -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)