<div dir="ltr">On Tue, Jan 3, 2012 at 05:17, Yucheng Zhang <span dir="ltr">&lt;<a href="mailto:yczhang89@gmail.com">yczhang89@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">
<div class="im">subsome :: [RRule nt t s] -&gt; Either String ([t], s)</div><div class="im">
<br>
</div>It seems to me that the compiler is not sure the two &#39;nt&#39; are equal.<br>
The ScopedTypeVariables can make the compiler believe they are equal.</blockquote><div><br></div><div>But ScopedTypeVariables is enabled already.</div><div><br></div><div>OTOH, I *think* the embedded Ord constraint is screwing things up (which is why it&#39;s showing up in the error message), because it&#39;s embedded and therefore has its own limited scope which prevents ScopedTypeVariables from doing the right thing.  This idiosyncrasy is why those embedded constraints are being removed from the language except in more controllable and useful ways (namely GADTs; the H98 version is not capable of doing anything useful, as I understand it, it can only screw up typing in situations like this without actually adding anything useful to the type system, as it&#39;s not possible to bring the Ord constraint usefully into scope outside the data declaration itself).</div>
<div><br></div><div>(More technically, and I think this is correct:  the effective data type is</div><div><br></div><div>    (forall nt. <span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">Ord nt =&gt; LegGram (M.Map nt [RRule nt t s]))</span></div>
<div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">Note the outer parentheses; the Ord constraint is *only* active within those outer parentheses, meaning that it prevents the type of &quot;nt&quot; from matching that in any other use of the type, even in the same expression, even with ScopedTypeVariables.)</span></div>
<div> </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>