<div dir="ltr">Created some initial wiki-page with just one example, will keep it in mind to add more as seen.<br><br><a href="https://wiki.haskell.org/Expanding_type_synonyms_in_error_messages_proposal">https://wiki.haskell.org/Expanding_type_synonyms_in_error_messages_proposal</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 19, 2015 at 10:42 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 link="blue" vlink="purple" lang="EN-GB">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">On this thread, a representative collection of *<b>reproducible</b>
<b>examples</b>* with the actual error message and the desired one, would be tremendously helpful.  Lacking that, it’s hard to know where to begin.   (Creating the examples takes a bit of work, I know.)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Start a wiki page!  Stuff in email threads gets lost<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> ghc-devs [mailto:<a href="mailto:ghc-devs-bounces@haskell.org" target="_blank">ghc-devs-bounces@haskell.org</a>]
<b>On Behalf Of </b>Christopher Allen<br>
<b>Sent:</b> 19 June 2015 04:27<br>
<b>To:</b> Ömer Sinan Ağacan<br>
<b>Cc:</b> ghc-devs<br>
<b>Subject:</b> Re: expanding type synonyms in error messages<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
Just to add my own +1, having this when working with streaming libraries (I've needed it less with lens, oddly) would be a tremendous help for people learning them I think. I think I've run into the same thing as Kostiantyn in the past.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
On Thu, Jun 18, 2015 at 9:42 PM, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
It's good to see that I'm not the only one who wants this. I'm doing<br>
some GHC hacking nowadays and I'll give it a try.<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<br>
2015-06-18 4:41 GMT-04:00 Kostiantyn Rybnikov <<a href="mailto:k-bx@k-bx.com" target="_blank">k-bx@k-bx.com</a>>:<br>
> I wanted to add that synonym expansion would be especially helpful in<br>
> error-messages like:<br>
><br>
> Expected type: <non-expanded, small type, like "Producer a m ()"><br>
> Actual type: <your type, like "Proxy a a' b b' m v"><br>
><br>
> I would be glad if we could have an expansions enabling flag in GHC, and<br>
> could consider turning it on by default if it will look good for that.<br>
><br>
> 16 черв. 2015 22:44 "Richard Eisenberg" <<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>> пише:<br>
><br>
>> GHC tries hard to preserve type synonyms where possible, but of course, it<br>
>> can't preserve all of them. The general rule it tries to follow is: preserve<br>
>> vanilla type synonyms; expand type families. This is true both in expected<br>
>> types and actual types.<br>
>> If you have a case where you believe that GHC could preserve a type<br>
>> synonym in an expected type, submit a bug report. (Note that constraint<br>
>> synonyms are particularly hard to preserve!)<br>
>><br>
>> It would be very easy to report both the synonym-preserving form and the<br>
>> expanded form in an error report, at the cost of making error reports even<br>
>> more verbose. You're welcome to submit a feature request, and this would<br>
>> likely make a good first patch to GHC if you want to get your hands dirty.<br>
>> I'd personally prefer the feature to be protected behind a flag (to avoid<br>
>> seeing that `String` expands to `[Char]` everywhere, for example), but<br>
>> others may feel differently here.<br>
>><br>
>> Richard<br>
>><br>
>> On Jun 16, 2015, at 11:20 AM, Ömer Sinan Ağacan <<a href="mailto:omeragacan@gmail.com" target="_blank">omeragacan@gmail.com</a>><br>
>> wrote:<br>
>><br>
>> > Hi all,<br>
>> ><br>
>> > While working with complex types with lots of arguments etc. errors are<br>
>> > becoming annoying very fast. For example, GHC prints errors in this way:<br>
>> ><br>
>> >    Expected type: <type without any synonyms><br>
>> >      Actual type: <type with synonyms><br>
>> ><br>
>> > Now I have to expand that synonym in my head to understand the error.<br>
>> ><br>
>> > I was wondering if implementing something like this is possible:<br>
>> ><br>
>> > In type error messages, GHC also prints types that are cleaned from type<br>
>> > synonyms. Maybe something like this:<br>
>> ><br>
>> >         Expected type: <type1><br>
>> >    (without synonyms): <type1, synonyms are expanded><br>
>> >           Actual type: <type2><br>
>> >    (without synonyms): <type2, synonyms are expanded><br>
>> ><br>
>> > If this is not always desirable for some reason, we can hide this<br>
>> > behavior<br>
>> > behind a flag.<br>
>> ><br>
>> > What do GHC devs think about this? Is this, in theory, possible to do?<br>
>> > How hard<br>
>> > would it be to implement this?<br>
>> ><br>
>> > Thanks.<br>
>> > _______________________________________________<br>
>> > ghc-devs mailing list<br>
>> > <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
>> > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
>><br>
>> _______________________________________________<br>
>> ghc-devs mailing list<br>
>> <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<u></u> <u></u></p>
</div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
Chris Allen<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<span style="font-size:9.5pt">Currently working on </span><a href="http://haskellbook.com" target="_blank">http://haskellbook.com</a><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

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