Okay thanks I got the difference between both.<br>The &#39;exists&#39; syntax seems very useful. Is it planned to be added to GHC in a near future?<br><br><br><div class="gmail_quote">2011/2/28 Heinrich Apfelmus <span dir="ltr">&lt;<a href="mailto:apfelmus@quantentunnel.de">apfelmus@quantentunnel.de</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">Yves Parčs wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


 takeC :: Int -&gt; Compoz a b -&gt; (exists c. Compoz a c)<br>
 dropC :: Int -&gt; Compoz a b -&gt; (exists c. Compoz c b)<br>
</blockquote>
<br>
What does &#39;exists&#39; means? To create a rank-2 type can&#39;t you use:<br>
<br>
takeC :: Int -&gt; Compoz a b -&gt; (forall c. Compoz a c)<br>
<br>
??<br>
</blockquote>
<br></div>
Ah, (exists c. Compoz a c)  means  &quot;There exists a type  c  such that the whole thing has type  Compoz a c &quot;.<br>
<br>
What you describe would be the type &quot;For any type  c  the whole thing can be treated as having type   Compoz a c &quot; which is something entirely different.<br>
<br>
The point is that in the former version, the function  takeC  determines what the type  c  should be and the caller has no clue what it is. In the latter version, the function that calls  takeC  can choose which type it should be.<br>


<br>
What I wrote is *not* legal Haskell. (At least not in GHC. If I remember correctly, the EHC from Utrecht supports first-class existential quantification ). You have to encode it in some way, for instance with a data type<br>


<br>
   data Exists f = forall c . Exists (f c)<br>
   takeC :: Int -&gt; Compoz a b -&gt; Exists (Compoz a)<div><div></div><div class="h5"><br>
<br>
<br>
Regards,<br>
Heinrich Apfelmus<br>
<br>
--<br>
<a href="http://apfelmus.nfshost.com" target="_blank">http://apfelmus.nfshost.com</a><br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>