<div dir="ltr">Yes, that is the semantics I use for recursive module imports in jhc. And you are right in that it does not accept those examples due to being unable to bootstrap the least fixed point. <br><br>How would the 'as M' proposal interact? Would it actually be new entries in the name table or rewritten as a macro to the current module name? I can see some edge cases where it makes a difference. I am thinking the easiest would be to populate entries for all the M.toplevel names where toplevel are the top level definitions of the module, will implement it and see how it shakes out.<div><br></div><div>    John</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 5:18 AM, Iavor Diatchki <span dir="ltr"><<a href="mailto:iavor.diatchki@gmail.com" target="_blank">iavor.diatchki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hello,</p>
<p dir="ltr">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", <a href="http://yav.github.io/publications/modules98.pdf" target="_blank">http://yav.github.io/publications/modules98.pdf</a> ) this program is incorrect as the module does not export anything.</p>
<p dir="ltr">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:</p>
<p dir="ltr">module A (M.x) where<br>
  import B as M</p>
<p dir="ltr">module B (M.x) where<br>
  import A as M<br>
  x = True</p>
<p dir="ltr">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'?</p>
<p dir="ltr">Iavor<br>
</p>
<div class="gmail_quote"><div><div class="h5">On Sep 29, 2014 11:02 PM, "John Meacham" <<a href="mailto:john@repetae.net" target="_blank">john@repetae.net</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">You don't need a new language construct, what i do is:<div><br></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">     module AnnoyinglyLongModuleName (M.length, M.null) where</span><br></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">    import AnnoyinglongLongModuleName as M</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">I think ghc would need to be extended a little to make this convienient as it doesn't handle recursive module imports as transparently.</span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px">    John</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 29, 2014 at 8:47 AM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span><div class="gmail_quote">On Mon, Sep 29, 2014 at 4:19 AM, Herbert Valerio Riedel <span dir="ltr"><<a href="mailto:hvr@gnu.org" target="_blank">hvr@gnu.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">Now it'd be great if I could do the following instead:<br>
<br>
    module AnnoyinglyLongModuleName (M.length, M.null) where<br>
<br>
    import AnnoyinglyLongModuleName as M -- <- does not work<br></div></blockquote></div><br></span>I think if I wanted this syntax, I'd go for:</div><div class="gmail_extra"><br></div><div class="gmail_extra">    module AnnoyinglyLongModuleName as M where ...<span><font color="#888888"><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</font></span></div></div>
<br>_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org" target="_blank">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>John Meacham - <a href="http://notanumber.net/" target="_blank">http://notanumber.net/</a>
</div>
<br></div></div>_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>John Meacham - <a href="http://notanumber.net/" target="_blank">http://notanumber.net/</a>
</div>