<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Alejandro,<div class=""><br class=""></div><div class="">This distinction between top-level module and local module is pretty superficial. I've added a new bit to the proposal to explain this:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><li class=""><p class="">This proposal describes <em class="">top-level modules</em> as distinct from <em class="">local modules</em>, but this distinction
has little import. Here is the full set of differences between these concepts:</p>
<ol class="">
<li class="">The <code class="">module</code> keyword for a top-level module is the first lexeme in a file; the <code class="">module</code>
keyword for a local module must not be the first lexeme in a file.</li>
<li class="">A top-level module can have <code class="">import</code> statements; a local module can have only <code class="">import module</code>
statements.</li>
<li class="">An <code class="">import</code> statement can name only a top-level module, not a local module.</li>
</ol><p class="">That's it! If you like, you can think of a <code class="">import X</code> statement as a combination of
<code class="">import qualified X</code> and <code class="">import module X</code> statement: the first loads the external compilation
unit named <code class="">X</code> (in a file <code class="">X.hs</code>)
and brings lots of <code class="">X.blah</code> entities into scope, and the second removes the <code class="">X.</code> qualification.</p><p class="">Another way to think about this is that there is really no distinction between top-level modules
and local modules, but there is a distinction between a compilation unit and a module. An <code class="">import</code>
statement names a compilation unit, granting access to any modules it contains. Haskell separately
has two restrictions:</p>
<ol class="">
<li class="">Every compilation unit must contain exactly one module (which may contain other modules); the
compilation unit must have the same name as its one module.</li>
<li class=""><code class="">import</code> statements must go before all other statements (except, optionally, for a <code class="">module</code>
header) in a compilation unit (in order to
support finding dependencies while parsing only a prefix of a file).</li>
</ol>
</li></blockquote><div class="">I hope this helps!</div><div class="">Richard</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 23, 2021, at 7:16 AM, Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" class="">trupill@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div dir="ltr" class="">
    Re-reading the thread has made me aware of the distinction introduced by this proposal between “top-level” and “local modules”, which I do not fully grasp. I was under the impression that this was working more on the syntactic level (so if I write `module X where module Y where` this is similar to `module X.Y where`), and the specification was about sorting out how this works, but now I’m surprised about this new concept.</div><div dir="ltr" class=""><br class=""></div><div dir="ltr" class="">Regards,</div><div dir="ltr" class="">Alejandro<br class=""><br class="">
    <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">El 23 jul 2021 12:00:40, Simon Marlow <<a href="mailto:marlowsd@gmail.com" class="">marlowsd@gmail.com</a>> escribió:<br class=""></div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div dir="ltr" class=""><div class="">Just so I'm not completely silent: in the past I was generally in favour but had some suggestions. It looks like the proposal has undergone a lot of rewrites since I last reviewed it (or perhaps I just don't remember it all that well), I've started to go through it again but this is a biggie! <br class=""></div><div class=""><br class=""></div><div class="">I think a deadline is a good idea.<br class=""></div><br class=""><div class="">Cheers</div><div class="">Simon<br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 23 Jul 2021 at 07:23, Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io" class="">arnaud.spiwack@tweag.io</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class=""><div class="">Dear all,</div><div class=""><br class=""></div><div class="">I know that this proposal is a bit long, but it also deserves your attention.</div><div class=""><br class=""></div><div class="">I feel it's going to be easier to set a bit of time to review the proposal if I give a deadline. So let's say the following: I'll be on holiday starting two weeks from now (6th August), can I have everybody's opinion by then?</div><div class=""><br class=""></div><div class="">---</div><div class=""><br class=""></div><div class="">Recapitulating the opinions so far</div><div class=""><ul class=""><li class="">I'm personally pretty enthusiastic about the entire proposal</li><li class="">Tom voiced quite enthusiastic support for what Simon PJ calls (1), and (3)</li><li class="">Simon PJ wants (1), is not against (2), is mildly against (3)</li><li class="">Joachim suspends his judgement (which is fine, but hopefully not too many of us do this :-) ).<br class=""></li></ul></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 21, 2021 at 2:30 PM Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank" class="">simonpj@microsoft.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-GB" class="">
<div class=""><p class="MsoNormal"><span class="">To be clear, I’m ok with (1), luke-warm on (2), and mildly against (3)<u class=""></u><u class=""></u></span></p>
<ol type="1" start="1" class="">
<li class="MsoNormal">
Import and export of qualified names. This seems like the Main Point.<u class=""></u><u class=""></u></li><li class="MsoNormal">
Local import (in a let/where). This seems low pain but low gain.<u class=""></u><u class=""></u></li><li class="MsoNormal">
Local modules. This is the one I'm struggling with.<u class=""></u><u class=""></u></li></ol><p class="MsoNormal"><span class="">There is  more on the (tail end of the) PR
<a href="https://github.com/ghc-proposals/ghc-proposals/pull/283" target="_blank" class="">https://github.com/ghc-proposals/ghc-proposals/pull/283</a><u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><u class=""></u> <u class=""></u></span></p><p class="MsoNormal"><span class="">I am open to being educated.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><br class="">
I would love to hear from other members of the committee.  Tom’s thumbs-up seemed to about (1), without saying anything about (2) and (3).<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><u class=""></u> <u class=""></u></span></p><p class="MsoNormal"><span class="">One mechanism (if my categorisation is correct) could be to ask everyone to vote (yes/no/maybe) on all of 1,2,3.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><u class=""></u> <u class=""></u></span></p><p class="MsoNormal"><span class="">Arnaud, you are our shepherd.  Your sheep await your command.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><u class=""></u> <u class=""></u></span></p><p class="MsoNormal"><span class="">Simon<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span class=""><u class=""></u> <u class=""></u></span></p>
<div style="border-color:currentcolor currentcolor currentcolor blue;border-style:none none none solid;border-width:medium medium medium 1.5pt;padding:0cm 0cm 0cm 4pt" class="">
<div class="">
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm" class=""><p class="MsoNormal"><b class=""><span lang="EN-US" class="">From:</span></b><span lang="EN-US" class=""> ghc-steering-committee <<a href="mailto:ghc-steering-committee-bounces@haskell.org" target="_blank" class="">ghc-steering-committee-bounces@haskell.org</a>>
<b class="">On Behalf Of </b>Richard Eisenberg<br class="">
<b class="">Sent:</b> 19 July 2021 21:18<br class="">
<b class="">To:</b> Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io" target="_blank" class="">arnaud.spiwack@tweag.io</a>><br class="">
<b class="">Cc:</b> GHC Steering Committee <<a href="mailto:ghc-steering-committee@haskell.org" target="_blank" class="">ghc-steering-committee@haskell.org</a>><br class="">
<b class="">Subject:</b> Re: [ghc-steering-committee] #283: Local modules (again), recommendation: accept<u class=""></u><u class=""></u></span></p>
</div>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p><p class="MsoNormal">Any thoughts on this? Simon PJ seems lukewarm (or maybe even cooler than that), Arnaud is in support, but the rest of you have been quiet.<u class=""></u><u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Thanks!<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Richard<u class=""></u><u class=""></u></p>
<div class="">
<div class=""><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal">On Jun 11, 2021, at 3:05 AM, Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io" target="_blank" class="">arnaud.spiwack@tweag.io</a>> wrote:<u class=""></u><u class=""></u></p>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<div class="">
<div class=""><p class="MsoNormal">Dear all,<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Let me raise this proposal again. Very few of us have opined, and while I'd usually be happy to consider silence as assent, this is a rather large proposal which may require a few more pairs of eyes. Please consider giving this one a read
 and share your thoughts. If you can't do so right now, please let me know when you will be able to, so that we can plan accordingly.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">This is an important proposal, I'm keen on seeing its design finalised.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">/Arnaud<u class=""></u><u class=""></u></p>
</div>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<div class=""><p class="MsoNormal">On Wed, May 26, 2021 at 2:35 PM Richard Eisenberg <<a href="mailto:rae@richarde.dev" target="_blank" class="">rae@richarde.dev</a>> wrote:<u class=""></u><u class=""></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm" class="">
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal">On May 26, 2021, at 3:28 AM, Spiwack, Arnaud <<a href="mailto:arnaud.spiwack@tweag.io" target="_blank" class="">arnaud.spiwack@tweag.io</a>> wrote:<u class=""></u><u class=""></u></p>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<div class=""><p class="MsoNormal">I'm realising that I inverted additional options 1 and 3 in my reply. To spell things out: I'm in favour of the namespace introduced for every datatype and such; and weakly in favour of anonymous modules, for which I prefer the `_` syntax
 than simply omitting the name.<u class=""></u><u class=""></u></p>
</div>
</div>
</blockquote>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Oh, good. I was very confused here, but I decided not to push on it. I'm similarly weakly in favor of (1), but I can't get myself to decide firmly on whether to go with alternative (7). Going with (7) is a little more consistent with other
 features, but it adds more symbols to the source text that could otherwise be omitted. So I'm pretty ambivalent.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Richard<u class=""></u><u class=""></u></p>
</div><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<div class=""><p class="MsoNormal">On Tue, May 25, 2021 at 11:54 PM Richard Eisenberg <<a href="mailto:rae@richarde.dev" target="_blank" class="">rae@richarde.dev</a>> wrote:<u class=""></u><u class=""></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm" class="">
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal"><br class="">
<br class="">
<u class=""></u><u class=""></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal">On May 25, 2021, at 3:09 PM, Alejandro Serrano Mena <<a href="mailto:trupill@gmail.com" target="_blank" class="">trupill@gmail.com</a>> wrote:<u class=""></u><u class=""></u></p>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class="">
<div class=""><p class="MsoNormal"><span style="font-size:9pt;font-family:"Helvetica",sans-serif" class="">- I am not sure of the benefit of allowing (1), compared with the possible surprise of users.<u class=""></u><u class=""></u></span></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-size:9pt;font-family:"Helvetica",sans-serif" class="">- I do not fully understand (2).<u class=""></u><u class=""></u></span></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-size:9pt;font-family:"Helvetica",sans-serif" class="">- I think (3) would be great, if we ensure that nothing changes if I don’t use “qualified”, even if -XLocalModules is on.<u class=""></u><u class=""></u></span></p>
</div>
</div>
</blockquote>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
<div class=""><p class="MsoNormal">If in the language, I would use (1) -- anonymous local modules -- regularly, when defining a function or class instance with a bunch of "local" helper functions. Of course, if we can't omit the module name, I will suffer no great harm.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">I cannot offer the guarantee you seek in (3), but I don't think you want it. (If nothing changes, then the feature has no effect!) Here is a scenario where (3) could cause trouble:<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal">import Data.Set as Set ( abcde )<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">data Set = Mk { abcdf :: Int }<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">blah = Set.abcdf<u class=""></u><u class=""></u></p>
</div>
</blockquote>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Previously, GHC would have suggested that you perhaps misspelled abcde. Now, you'll get (presumably) a type error.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Here's another case:<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt" class="">
<div class=""><p class="MsoNormal">import Data.Set as Set ( Set )<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">data Set = Mk<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">x :: Set.Set<u class=""></u><u class=""></u></p>
</div>
</blockquote>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Everything is happy today, but with -XLocalModules (and (3)), the type of x is an ambiguous name.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Any example that causes trouble, though, will have something in common: an imported module name (possibly via an alias) that matches a locally defined type name. I would imagine this pattern is rare in practice, and that the benefit of
 (3) would outweigh the number of times that a problem like this bites.<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">I, too, could live without (2).<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Richard<u class=""></u><u class=""></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div><p class="MsoNormal"><u class=""></u> <u class=""></u></p>
</div>
</div>
</div>
</div>
</div>

</blockquote></div></div>
_______________________________________________<br class="">
ghc-steering-committee mailing list<br class="">
<a href="mailto:ghc-steering-committee@haskell.org" target="_blank" class="">ghc-steering-committee@haskell.org</a><br class="">
<a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" rel="noreferrer" target="_blank" class="">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br class="">
</blockquote></div>

<div class="">
<div class="">
    _______________________________________________<br class="">ghc-steering-committee mailing list<br class=""><a href="mailto:ghc-steering-committee@haskell.org" class="">ghc-steering-committee@haskell.org</a><br class=""><a href="https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee" class="">https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee</a><br class="">
</div>
</div>
        </blockquote>
    </div>
</div></div>
</div></blockquote></div><br class=""></div></body></html>