I accidentally the Prelude

Simon Marlow marlowsd at gmail.com
Tue Mar 2 11:39:08 EST 2010

On 02/03/2010 15:46, Jeremy Shaw wrote:
> I would still vote for that error in the 'worst ghc error message
> contest'. I got it just last night with 6.13 when I tried to run the
> Setup.hs function in base:
> ~/n-heptane/projects/haskell/darcs/base- $ rm Setup.o Setup.hi
> ~/n-heptane/projects/haskell/darcs/base- $ ghc --make -O2
> Setup.hs -o s
> [1 of 1] Compiling Main             ( Setup.hs, Setup.o )
> Setup.hs:1:1:
>      attempting to use module `Prelude' (./Prelude.hs) which is not loaded
> ~/n-heptane/projects/haskell/darcs/base- $ runhaskell Setup.hs
> configure
> Setup.hs:1:1:
>      attempting to use module `Prelude' (./Prelude.hs) which is not loaded
> ~/n-heptane/projects/haskell/darcs/base- $

Oh, the problem here is that GHC hasn't figured out that it should 
consider Prelude to be a local dependency of Setup, because it only 
looks at the imports, and Prelude is an implicit import.  With Prelude 
not being found during dependency analysis, it wasn't compiled first, so 
when we got around to trying to import it we found that it was not "loaded".

Perhaps the implicit import of Prelude should be

   import "base" Prelude

rather than

   import Prelude

that would avoid these problems.  But it would present a problem for 
someone who wanted to use their own Prelude.  At the least I guess we 
should consider Prelude to be an implicit dependency during dependency 

What you wanted to do above was "ghc --make Setup -i", incedentally. 
And if we fix the dependency thing, you'll still need to do that, 
because otherwise GHC will try to recompile the whole of base, and 
something else will almost certainly go wrong because there will be two 


More information about the Glasgow-haskell-users mailing list