<div dir="ltr">No objections here.<div><br></div><div>The types involved really <b>do</b> have <font face="courier new, monospace">FlexibleContexts</font> in them, so it makes sense to require the extension. </div><div><br>
</div><div>The upgrade path for library authors is also clear. It'll complain to add the extension, and they'll fix it by adding the line of code suggested and perhaps realize something about their code in the process.</div>
<div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 21, 2014 at 4:30 AM, Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Friends<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">GHC generally obeys this rule<u></u><u></u></span></p>
<p><u></u><span style="font-size:12.0pt;font-family:Symbol"><span>·<span style="font:7.0pt "Times New Roman"">
</span></span></span><u></u><span style="font-size:12.0pt">If GHC infers a type
</span><b><span style="font-size:12.0pt;font-family:"Courier New"">f::type</span></b><span style="font-size:12.0pt">, then it’s OK for you to add a type signature saying exactly that.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">For example, it rejects inferred types that are ambiguous. I think this is a good property; it was certainly the source of many bug reports before inferred ambiguous types were rejected.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">However, up to now (including in 7.8) GHC hasn’t followed this rule consistently. In particular, it will infer types like<u></u><u></u></span></p>
<pre><span style="font-size:12.0pt;font-family:"Calibri","sans-serif""> </span>fold :: (Functor (PF a), Regular a) => (PF a b -> b) -> a -> b<u></u><u></u></pre>
<p class="MsoNormal"><span style="font-size:12.0pt">(where PF is a type family). If you write this as a type signature, GHC will insist on
</span><span style="font-size:12.0pt;font-family:"Courier New"">FlexibleContexts</span><span style="font-size:12.0pt"> and
</span><span style="font-size:12.0pt;font-family:"Courier New"">TypeFamilies</span><span style="font-size:12.0pt">.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">So in <a href="https://ghc.haskell.org/trac/ghc/ticket/8883" target="_blank">
https://ghc.haskell.org/trac/ghc/ticket/8883</a>, Jan has made GHC check inferred types in the same way that it checks declared types, thus rejecting the above inferred type unless you give the language extensions.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">This makes the compiler more consistent.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt">But it does mean that some code may be rejected that 7.8 accepts. This email is just a heads-up that you might want to compile your library with 7.10 (i.e. a snapshot of HEAD) well in advance. There will
be other breaking changes of course; e.g Applicative will finally be a superclass of Monad, for example.<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><span style="font-size:12.0pt">Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt"><u></u> <u></u></span></p>
</font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "haskell-core-libraries" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:haskell-core-libraries+unsubscribe@googlegroups.com" target="_blank">haskell-core-libraries+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.<br>
</font></span></blockquote></div><br></div>