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

Michael Orlitzky michael at orlitzky.com
Tue Jul 15 17:30:48 UTC 2014


On 07/14/2014 11:23 PM, Andrew Gibiansky wrote:
> 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. 
> 

To play devil's advocate, I don't think this is a good idea. It moves
information that is fundamentally local (which library imports a module
requires) into global state: magic flags that must be passed to the
build system for anything to work.

It would be super annoying for an {IDE, coworker, ...} to have to
analyze your build system just to figure out which functions are in scope.

We went down this road once before with -fglasgow-exts. Eventually, we
all realized it was much better to place the required extensions in
pragmas at the top of the file.



More information about the Haskell-Cafe mailing list