<div dir="ltr">On Tue, Jul 31, 2012 at 2:59 PM, Shayan Najd Javadipour <span dir="ltr">&lt;<a href="mailto:sh.najd@gmail.com" target="_blank">sh.najd@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><pre style="text-align:left;margin-bottom:0px;margin-top:0px"><span style="font-size:13px;color:rgb(85,85,85)">{-# LANGUAGE GADTs,RankNTypes #-}</span><font size="3">
</font><span style="font-size:13px;color:rgb(57,116,96)">data</span><font size="3"> </font><span style="font-size:13px;color:rgb(79,67,113)">T</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">a</span><font size="3"> </font><span style="font-size:13px;color:rgb(57,116,96)">where</span><font size="3"> </font><span style="font-size:13px;color:rgb(79,67,113)">T1</span><font size="3"> </font><span style="font-size:13px">::</span><font size="3"> </font><span style="font-size:13px">(</span><span style="font-size:13px;color:rgb(57,116,96)">forall</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">b</span><span style="font-size:13px;color:rgb(51,51,51)">.</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">b</span><font size="3"> </font><span style="font-size:13px">-&gt;</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">b</span><span style="font-size:13px">)</span><font size="3"> </font><span style="font-size:13px">-&gt;</span><font size="3"> </font><span style="font-size:13px">(</span><span style="font-size:13px;color:rgb(57,116,96)">forall</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">a</span><span style="font-size:13px;color:rgb(51,51,51)">.</span><font size="3"> </font><span style="font-size:13px;color:rgb(79,67,113)">Int</span><font size="3"> </font><span style="font-size:13px">-&gt;</span><font size="3"> </font><span style="font-size:13px;color:rgb(79,67,113)">T</span><font size="3"> </font><span style="font-size:13px;color:rgb(51,51,51)">a</span><span style="font-size:13px">)</span><font size="3">

</font><font color="#555555" style="font-size:13px">{- Error:
Data constructor `T1&#39; returns type `forall a. Int -&gt; T a&#39;
      instead of an instance of its parent type `T a&#39;
</font></pre></div></blockquote><div><br></div><div>This looks to me like other cases where GHC requires an exact type match even though you used something equivalent.  Similarly, for example, it rejects (contrived example)</div>
<div><br></div><div>    foo :: Num a =&gt; a -&gt; a -&gt; a</div><div>    foo 0 0 = -1</div><div>    foo = (+)</div><div><br></div><div>because the explicit arity of the cases must match exactly, even though (+)&#39;s type matches the required arity.  I am under the impression that it&#39;s difficult to make those kinds of things work nicely in the typechecker.</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>