My first thought is: Wouldn't this make it impossible to reorder or sort imports lexicographically (or otherwise), without fully parsing, renaming and typechecking the code?
For example, I often use ghc-mod plus stylish-haskell to order and format my imports. If there is no syntactic indication that one import should be hidden (and another preferred) as there is now, then reordering the imports of a working program willy-nilly could result in a program that no longer typechecks (or worse, one that does, but is now wrong). Maybe there are some cases today where something like this could happen, but this seems awfully, awfully implicit and hard-to-follow as a language feature. In general I think a program that has imports like this that may clash can be automated to make it easier to manage - but ultimately such imports tend to represent a complex relationship between a module and its dependencies - I'd prefer it if these were as clear as possible. On Thu, Oct 16, 2014 at 5:19 PM, Malcolm Gooding <goodi...@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@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users > -- Regards, Austin Seipp, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users