[EMAIL PROTECTED] wrote:
"Simon Peyton-Jones" <[EMAIL PROTECTED]> writes:

Brian Hulley wrote:
|   import A.B.C( T1 ) from "foo"
|   import A.B.C( T2 ) from "bar"
|   type S = A.B.C.T1 -> A.B.C.T2
| I'd suggest that the above should give a compiler error that A.B.C is
| ambiguous (as a qualifier), rather than allowing T1 to disambiguate
it,
But that's inconsistent with Haskell 98.
FWIW, I agree with Brian that this is not good practice. If it can't
be forbidden, I would suggest that compilers emit a warning about it.

Is there really a case where someone would use that pattern intentionally?
 I'd vote for making it an error by default.  Perhaps then a flag would be
available that says "accept dangerous constructs that are legal according
to Haskell 98".


The Haskell 98 behavior compensates for the case where the module you used to import Old (foo,bar) has been split into two new modules, A(foo) and B(bar). You can import A as Old and B as Old so that Old.foo and Old.bar now resolve to A.foo and B.bar.

I expect the pattern for the above would actually be closer to

> import Old(T1,T2) from "original"
>
> mine :: Old.T1 -> Old.T2

becoming

> import qualified A.B.C(T1) as Old from "foo"
> import qualified D.E.F(T2) as Old from "bar"
>
> mine :: Old.T1 -> Old.T2

Which is a syntax that should be supported.

--
Chris
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to