<div dir="ltr">On Tue, Jan 3, 2012 at 06:43, Yves Parès <span dir="ltr">&lt;<a href="mailto:limestrael@gmail.com">limestrael@gmail.com</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">
That is error-prone.<br>Plus the code does not need ScopedTypeVariables. The real problem comes from the use of a class constraint on the LegGram data constructor.<br><br><span style="font-family:courier new,monospace">data LegGram nt t s = Ord nt =&gt; LegGram (M.Map nt [RRule nt t s])<br>


<br><font face="arial,helvetica,sans-serif">Short answer: you <b>can&#39;t </b>add class constraints to an already declared type variable:<br><br>The LegGram <b>type </b>constructor declares the &#39;nt&#39; variable (and then brings it into scope), so trying afterwards to add a constraint to it for the LegGram <b>data </b>constructor is invalid, so the compiler understands this:<br>


</font></span><span style="font-family:courier new,monospace">data LegGram nt t s = <b>forall nt.</b> Ord nt =&gt; LegGram (M.Map <b>nt</b> [RRule <b>nt</b> t s])</span><br><font><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">...the declaration and scoping of a </font><b style="font-family:&#39;courier new&#39;,monospace">new</b><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"> type variable.</font><br>


<br><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">This is it, right?</font></font></blockquote><div><br></div><div>Yep, with the additional gotcha that two uses of the same data constructor in an expression will not unify those type variables because it&#39;s scoped to the data constructor itself.  Which is the confusing and error-prone behavior that led to it being removed from the next version of the standard (probably; the proposal was accepted but H&#39;2011 was bypassed and H&#39;2012 has not yet started).</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>