<div dir="ltr">Hello,<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 24, 2013 at 12:42 AM, Daniel Gorín <span dir="ltr">&lt;<a href="mailto:dgorin@dc.uba.ar" target="_blank">dgorin@dc.uba.ar</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On May 24, 2013, at 9:28 AM, Simon Peyton-Jones wrote:<br>
<br>
&gt; How about (in Haskell98)<br>
&gt;<br>
&gt;       module Data.List ( foldr, ...)<br>
&gt;       import qualified Data.Foldable<br>
&gt;       foldr :: (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
&gt;       foldr = Data.Foldable.foldr<br>
<br>
</div>It would not be the same! Using your example one will get that the following fails to compile:<br>
<br>
&gt; import Data.List<br>
&gt; import Data.Foldable<br>
&gt; f = foldr<br>
<br>
The problem is that Data.List.foldr and Data.Foldable.foldr are here different symbols with the same name.<br>
This is precisely why Foldable, Traversable, Category, etc are awkward to use. The proposal is to make Data.List reexport Data.Foldable.foldr (with a more specialized type) so that the module above can be accepted.<br>
<br></blockquote><div><br></div><div style>I think that it is perfectly reasonable for this to fail to compile---to me, this sort of implicit shadowing based on what extensions are turned on would be very confusing.  It may seem obvious with a well-known example, such as `foldr`, but I can easily imagine getting a headache trying to figure out a new library that makes uses the proposed feature in anger :)</div>
<div style><br></div><div style>Also, using module-level language extensions does not seem like the right tool for this task: what if I wanted to use the most general version of one symbol, but the most specific version of another?  One needs a more fine grained tool, and I think that current module system already provides enough features to do so (e.g., explicit export lists, `hiding` clauses`, and qualified imports).  For example, it really does not seem that inconvenient (and, in fact, I find it helpful!) to write the following:</div>
<div style><br></div><div style><font face="courier new, monospace">    import Data.List hiding (foldr)</font></div><div style><font face="courier new, monospace">    import Data.Foldable</font></div><div style><br></div>
<div style>Last, but not least, in my experience being explicit about the dependencies of a module (i.e., using implicit import lists and qualified imports) tends to lead to (i) more robust code because it reduces accidental breakage due to new versions of libraries, and (ii) more readable code, because it makes it easier to follow the code dependencies, which is especially important when studying a new large code base.</div>
<div style><br></div><div style>-Iavor</div><div style><br></div><div style><br></div><div style><br></div><div style><br></div><div> </div></div></div></div>