[Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude

Andrew Gibiansky andrew.gibiansky at gmail.com
Tue Jul 15 03:23:21 UTC 2014


Hey all,

I would like to propose a very minor flag to add to GHC. I would like GHC
to have a --with-prelude flag, which would specify an alternate Prelude to
use instead of the default Haskell prelude.

This would have an effect similar to -XNoImplicitPrelude and an additional

import MyNewPrelude

in the source file. It might be a *little* different semantically, as a
qualified import would disable the original implicit import, just like it
does with the default Haskell prelude.

The benefit this would have is that this would give alternate preludes a
more first-class status. Instead of having to import an alternative prelude
everywhere, you could just have a ghc-options: --with-prelude=... flag in
your *.cabal file, and have a different prelude be used. This is important
for my own work, as I highly prefer other preludes for my non-library
development; I think this is a feature which will be very useful as Haskell
develops and we try to figure out how to get rid of the warts in the
current Prelude.

In order to specify the actula module, I propose that you just pass the
module name as the --with-prelude argument. You could thus invoke GHC like
this:

ghc --with-prelude=MyNewPrelude Main.hs

Then, the same rules apply for figuring out which MyNewPrelude module you
are referring to as if you had written a `import MyNewPrelude` statement in
the file.

I am willing to implement this for GHC if people agree that this is a
useful flag (or at least agree that isn't not a *bad* idea).

What are your thoughts on this proposal?

-- Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140714/03e2745a/attachment.html>


More information about the Haskell-Cafe mailing list