<p>Has anyone used existential types to represent items on a schedule in a scheduled lazy data structure?</p>
<div class="gmail_quote">On Aug 11, 2012 4:15 AM,  &lt;<a href="mailto:oleg@okmij.org">oleg@okmij.org</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
&gt; data A = A deriving Show<br>
&gt; data B = B deriving Show<br>
&gt; data C = C deriving Show<br>
&gt;<br>
&gt; data Foo = forall a. Show a =&gt; MkFoo a (Int -&gt; Bool)<br>
&gt;<br>
&gt; instance Show Foo where<br>
&gt;    show (MkFoo a f) = show a<br>
<br>
I&#39;d like to point out that the only operation we can do on the first<br>
argument of MkFoo is to show to it. This is all we can ever do:<br>
we have no idea of its type but we know we can show it and get a<br>
String. Why not to apply show to start with (it won&#39;t be evaluated<br>
until required anyway)? Therefore, the data type Foo above is in all<br>
respects equivalent to<br>
<br>
&gt; data Foo = MkFoo String (Int -&gt; Bool)<br>
<br>
and no existentials are ever needed. The following article explains<br>
elimination of existentials in more detail, touching upon the original<br>
problem, of bringing different types into union.<br>
<br>
        <a href="http://okmij.org/ftp/Computation/Existentials.html" target="_blank">http://okmij.org/ftp/Computation/Existentials.html</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">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>
</blockquote></div>