Unexpected NoImplicitPrelude behaviour in GHCi (bug?)
"Philip K.F. Hölzenspies"
p.k.f.holzenspies at utwente.nl
Tue Jun 15 07:19:23 EDT 2010
On Jun 11, 2010, at 5:10 AM, Brandon S. Allbery KF8NH wrote:
<snip>
> This doesn't surprise me; when putting it in the module, it affects only that module. When using either command line version, it affects *everything*... and what's breaking is not your definition of Number, but the ghci expression printer (which, being in IO, is doing something like (print it >> putStr "\n"). Since the command line option has global effect, the Prelude's (>>) isn't defined for ghci's guts either.
Your explanation would make perfect sense to me; pragma's in the module effect only the module. This is, however, nog GHCi's behaviour. If I have a module that's only this:
{-# LANGUAGE NoImplicitPrelude #-}
module Foo where
and I open this in GHCi, I get the following session:
Ok, modules loaded: Foo.
*Foo> 42
42
*Foo> 42.0
42.0
*Foo> :t 42
42 :: (GHC.Num.Num t) => t
*Foo> 40 + 2
<interactive>:1:3: Not in scope: `+'
*Foo> :t fromRational
<interactive>:1:0: Not in scope: `fromRational'
*Foo>
This means that there is *some* definition of fromInteger, fromRational and (>>), but it's not accessible for me at the prompt. Types and typeclasses seem to be imported fully qualified. I would either expect GHCi to start complaining when I type 42, or to not complain about any of these above commands.
Any thoughts?
Regards,
Philip
More information about the Glasgow-haskell-users
mailing list