Hiding import behaviour

David Feuer david.feuer at gmail.com
Thu Oct 16 22:29:06 UTC 2014


I think this is a great idea. I also think it should apply to the name
shadowing warning—identifiers imported implicitly should never trigger that.

On Thu, Oct 16, 2014 at 6:19 PM, Malcolm Gooding <goodingm at gmail.com> wrote:

> With the prelude changes that people have been discussing recently
> I've been wondering is there any reason why importing an identifier
> explicitly and unqualified doesn't automatically hide any implicit
> imports of the same identifier? Specifically I'm wondering about cases
> where you've imported an identifier explicitly from only one module,
> like this:
>
> module Foo (x, ...) where { ... }
> module Bar (x, ...) where { ... }
>
> import Bar
> import Foo (x)
>
> Even if you needed a pragma to enable it I can't think of any sensible
> reason why that shouldn't be equivalent to:
>
> import Bar hiding (x)
> import Foo (x)
>
> I don't know much of GHC's internals, but it seems like a pretty
> minimal change. Typing rules remain the same; explicit imports just
> shadow implicits. So importing multiple identifiers both implicitly or
> both explicitly would remain ambiguous.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20141016/cba09f15/attachment.html>


More information about the Glasgow-haskell-users mailing list