
If there is to be such a language feature, I strongly feel it should be via something like
module Long.Name.M( f, g, h ) as K where ...
I do not want to try to piggy-back on the possible meaning of a self-import; it’s just asking for trouble, as Iavor points out.
Using “as M” in the module header would be simple. It is easy to explain and fairly easy to implement. I don’t think there are any knock-on complications. So if enough people want it, and someone is prepared to implement it (with a language extension flag of course), then I’d be OK with that. I’m unsure that it’s worth the effort, but I’m happy to let users decide.
Simon
From: Glasgow-haskell-users [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of Iavor Diatchki
Sent: 30 September 2014 13:18
To: john@repetae.net
Cc: GHC Users Mailing List; ghc-devs; Herbert Valerio Riedel
Subject: Re: Aliasing current module qualifier
Hello,
What semantics are you using for recursive modules? As far as I see, if you take a least fixed point semantics (e.g. as described in "A Formal Specification for the Haskell 98 Module System", http://yav.github.io/publications/modules98.pdf ) this program is incorrect as the module does not export anything.
While this may seem a bit counter intuitive at first, this semantics has the benefit of being precise, easily specified, and uniform (e.g it does not require any special treatment of the " current " module). As an example, consider the following variation of your program, where I just moved the definition in a sperate (still recursive) module:
module A (M.x) where
import B as M
module B (M.x) where
import A as M
x = True
I think that it'd be quite confusing if a single recursive module worked differently then a larger recursive group, but it is not at all obvious why B should export 'x'. And for those who like this kind of puzzle: what should happen if 'A' also had a definition for 'x'?
Iavor
On Sep 29, 2014 11:02 PM, "John Meacham"