On 05/06/13 02:53, Manuel M T Chakravarty wrote:
Ian Lynagh <i...@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.
Furthermore, this is a direct extension of the current behaviour.
Currently:
- any import declaration that imports 'Prelude' implies
NoImplicitPrelude.
Proposed:
- any import declaration that imports 'Prelude' or a module
beginning 'Prelude.' implies NoImplicitPrelude.
It's a tiny generalisation, but a very useful one I think.
Cheers,
Simon
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime