Allow top-level shadowing for imported names?

Yitzchak Gale gale at sefer.org
Mon Oct 10 09:40:38 UTC 2016


Michael Sloan wrote:
> It is really good to think in terms of a cleverness budget...
> Here are the things I see in favor of this proposal:
>
> 1) It is common practice to use -Wall...
> 2) It lets us do things that are otherwise quite inconvenient...

You missed the most important plus:

0) It fixes an inconsistency and thus simplifies Haskell syntax.

So in my opinion this is not a cleverness proposal, it's a
simplication.

> 2) There is no good way to use this feature without creating a
> warning.

I'm not sure what you mean. There is already a warning for
shadowing. Except shadowing from imports, where it is an
error instead. The proposal is to eliminate that special
case.

>  I would like to be explicit in my name shadowing  I'm
> thinking a pragma like {-# NO_WARN myFunction #-},
> or, better yet, the more specific
> {-# SHADOWING myFunction #-} orso.

The same applies to shadowing in every other context.
Adding such a pragma might indeed be a nice idea. But
it should apply consistently to shadowing in all contexts,
not just for import shadowing. In any case, this
would be a separate proposal.

-Yitz


More information about the ghc-devs mailing list