On Fri, Feb 18, 2011 at 7:27 AM, Christian Maeder <span dir="ltr">&lt;<a href="mailto:Christian.Maeder@dfki.de">Christian.Maeder@dfki.de</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
the following code goes through parsec-2 (and parsec1) but is rejected<br>
by parsec-3<br> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 import Text.ParserCombinators.Parsec<br>
 gqrrel = many1 (alphaNum &lt;|&gt; char &#39;_&#39;)<br>
 myparser = sepBy gqrrel (char &#39;,&#39;)</blockquote><div><br></div><div>With top level type annotations, it compiles just fine. These annotations are considered a best practice, their absence is even complained about with -Wall, and the extra utility of parsec-3 far outweighs their cost, IMHO.</div>
<div><br></div><div>gqrrel :: Parser String</div><div>gqrrel = many1 (alphaNum &lt;|&gt; char &#39;_&#39;)</div><div><br></div><div>myparser :: Parser [String]</div><div>myparser = sepBy gqrrel (char &#39;,&#39;)</div><div>
<br></div><div>The problem is that the Stream class is an MPTC deliberately crafted without a fundep between the stream type and the monad in question. Any fix is likely to be worse than the disease, since to make type inference work for all scenarios that it works in Parsec-2, you&#39;d need the fundeps for the stream class to be able to infer the other 2 arguments given any one of them. You&#39;d lose the stream instances for lists, bytestring, etc. that work for all monads rather than just Identity.</div>
<div><br></div><div>I still remain enthusiastic about the prospect of including parsec-3 in the platform.</div><div><br></div><div>-Edward Kmett</div></div>