I accidentally the Prelude

Simon Marlow marlowsd at gmail.com
Wed Mar 3 07:47:43 EST 2010


On 03/03/2010 12:37, Yitzchak Gale wrote:
> Jeremy Shaw wrote:
>>>> I would still vote for that error in the 'worst ghc error message
>>>> contest'...
>
> I wrote:
>>> Can't we add something like "(Is there more than one
>>> Prelude in your path?)" to the message for Prelude?
>
> Simon Marlow wrote:
>> So I could add a warning ("Warning: this Prelude module is shadowing the
>> real Prelude", or something), but then we'd need a new flag to turn off the
>> warning if shadowing the Prelude is what you're really trying to do, and
>> that sounds like an awful lot of bother to fix a very rare corner case.  Or
>> can anyone think of a better way to handle this?
>
> I was suggesting that whenever the Prelude fails to load,
> the error message should contain that hint.

hmm, I'll think about that. Is it not enough to see a compilation error 
pointing to the file Prelude.hs?

> We'd also like to help rescue people who get weird behavior
> when, unbeknownst to them, the wrong Prelude loads
> successfully. But I understand your point that this second case
> is trickier and may not be worth the effort.

it's probably not that bad, actually:

$ ghc --make hello
[1 of 2] Compiling Prelude          ( Prelude.hs, Prelude.o )
[2 of 2] Compiling Main             ( hello.hs, hello.o )

hello.hs:1:8: Not in scope: `putStr'


You can pretty clearly see what happened there.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list