Hiding import behaviour

Herbert Valerio Riedel hvr at gnu.org
Sun Oct 19 07:56:04 UTC 2014


On 2014-10-19 at 00:39:42 +0200, Joachim Breitner wrote:
>> I guess my central point is I don't see how anyone can benefit from the
>> current behaviour. For instance, a simple real world example:
>> 
>> import Prelude
>> import Data.Text.Lazy.IO (putStrLn)
>
> I find this quite convincing. If I bother to explicitly write out „take
> putStrLn from Data.Text.Lazy.IO“, why should the compiler assume that I
> might have meant some putStrLn from somewhere else.

I think we've reached the point where this proposal should be turned
into a Wiki page detailing the exact semantics[1], and giving this
extension a catchy name...

If it's trivial enough (in the sense there is little design-space
variation to get it wrong), having it in 7.10 rather than 7.12 may be
still possible (and IMHO desirable to be able to start using it earlier
rather than later on real-world code).


 [1]: Cases to consider include all combinations of variations of
      import-statements; as well as turning most unqualified imports
      from which entities are to be hidden into a pair of qualified and
      unqualified import:

          import Doo (doo)
          import Bar -- provide 'doo' as well

      which I'd think should be transformed into
  
          import Doo (doo)
          import qualified Bar
          import Bar hiding (doo)

      as to allow to still have 'Bar.doo' in scope (unless some other
      import explicitly mentions `... as Bar (doo)`, in which case that
      needs to be hidden from the qualified `Bar` import as well)

Cheers,
  hvr


More information about the Glasgow-haskell-users mailing list