Proposal: NoImplicitPreludeImport

Manuel M T Chakravarty chak at cse.unsw.edu.au
Wed Jun 5 03:53:52 CEST 2013


Ian Lynagh <ian at well-typed.com>:
> On Tue, Jun 04, 2013 at 01:15:58PM +1000, Manuel M T Chakravarty wrote:
>> 
>> If a module contains an import of the form
>> 
>>  import Prelude.XYZ
>> 
>> then it also automatically uses the NoImplicitPrelude language pragma. Otherwise, the Prelude remains to be implicitly defined as before.
> 
> What about these?:
> 
>    import Prelude.XYZ as Foo

In that case, I think, we should also have NoImplicitPrelude, but in case of

>    import qualified Prelude.XYZ as Foo

they might to explicitly want to avoid clashes with the implicit Prelude. This would be an argument to not have NoImplicitPrelude in this case. On the other hand, simpler is better; so, maybe it shouldn't depend on the way a 'Prelude.XYZ' module is imported and we should use NoImplicitPrelude regardless.

>    import Foo as Prelude.XYZ

I would say that doesn't qualify for having NoImplicitPrelude, but I don't feel strongly about that.

Summary
~~~~~~~

If and only if a module has at least one impdecl of the form

  'import' ['qualified'] Prelude.XYZ ['as' modid] [impspec]

then this implies {-# LANGUAGE NoImplicitPrelude #-}.

That is a simple rule with no surprises.

Manuel






More information about the Haskell-prime mailing list