
I’m sorry I’m slow, but I just don’t yet understand what is being proposed.
Joachim launched the discussion herehttps://mail.haskell.org/pipermail/ghc-steering-committee/2020-April/001533..... I believe that he is advocating section 6.1 in the proposal. Moreover he has some variant of it in mind. I asked some questionshttps://mail.haskell.org/pipermail/ghc-steering-committee/2020-April/001545.... about the variant that may or may not have been answered.
It would be really helpful to have a single source of truth. Perhaps someone (Joachim or anyone else) can write a Google doc that describes, as precisely as possible, the proposal that he is advocating. Or get the proposal authors to do so. Just saying “a variant where the value does not need to be in scope” does not count as a specification (to me).
Iavor’s writeup below is helpful, but I fall over immediately. First, I believe that his (1-4) things are not *design* alternatives; they are all things the programmer can write, all under Section 6.1 of the proposal (unmodified). Is that right.
Then.
1. import MyMonad as M
(+) other operations do not need to be qualified
(-) unqualified `>>=` may be ambiguous
What are “other operations”?
Why might “>>=” be ambiguous? I think the answer is: because MyMonad must export it (to use in M.do), but it may already be in scope from the Prelude.
I’m strongly inclined against inventing new complexity in the module system, unless it is absolutely unavoidable. More to specify, more to explain, more to understand, more to implement.
Simon
From: ghc-steering-committee
Qualified names like M.foo, which always mean “the foo imported from module M – albeit with import-qualified you can change the local name”
but it’s not that simple: What if I write import qualified M1 as M import qualified M2 as M and then use M.foo? Well, it resolves the foo imported from M1, if M1 exports it. Or from M2, if M2 exports it. But what if both export it? Then we get an “ambiguity error”… Unless M1.foo and M2.foo, via re-exports, point to the same original name. What is proposed for M.(>>) here is the same logic, with the addition that it doesn’t matter whether you used “hiding ((>>))” somewhere in these imports, or imported (), to keep the nice existing rule “You only import what you explicitly mention” In terms of implementation I don’t think the burden is high; GHC already has that logic for the “M.foo is not in scope, did you want to add foo to the export list in line x” error message. Cheers, Joachim -- Joachim Breitner mail@joachim-breitner.demailto:mail@joachim-breitner.de http://www.joachim-breitner.de/https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.joachim-breitner.de%2F&data=02%7C01%7Csimonpj%40microsoft.com%7C66be21fcd8d74e052a3608d7e08f1857%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637224777509071750&sdata=TWMDeXho9obNmy%2FW0DJQn5Lq5PmQcWXh4NTRoLt2bvo%3D&reserved=0 _______________________________________________ ghc-steering-committee mailing list ghc-steering-committee@haskell.orgmailto:ghc-steering-committee@haskell.org https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committeehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-steering-committee&data=02%7C01%7Csimonpj%40microsoft.com%7C66be21fcd8d74e052a3608d7e08f1857%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637224777509081745&sdata=ytwWAGYW8iNbV2MNYf7hiUWvwOHat1noPOu0swTYbgw%3D&reserved=0