<div dir="ltr">Would you please explain this a bit more:<br><br><blockquote> the various<br>
unfortunate consequences of type erasure in Java are avoided by the fact<br>
that Haskell types lack constructors, so the user never expects to be<br>
able to conjure up a value of an unknown type.<br></blockquote>Thanks,<br><br>daryoush<br><br><br><div class="gmail_quote">On Wed, Oct 15, 2008 at 12:04 PM, Jonathan Cast <span dir="ltr">&lt;<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Wed, 2008-10-15 at 11:56 -0700, Daryoush Mehrtash wrote:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; The equivalent won&#39;t compile in Haskell, because the actual<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; return<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; type does matter, and *is determined by the calling code*.<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Our<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; fictional GetListOfData can&#39;t return a List or a Mylist<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; depending on<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; some conditional, in fact it can&#39;t explicitly return either<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; one at<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; all, because the actual type of the result, as determined by<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; the<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; caller, could be either one, or something else entirely<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; (ignoring the<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; IO bit for the time being).<br>
&gt;<br>
&gt;<br>
&gt; I have had an &nbsp;unresolved issue on my stack of Haskell vs Java that I<br>
&gt; wonder if your observation explains.<br>
&gt;<br>
&gt; If you notice &nbsp;java generics has all sort of gotchas (e.g.<br>
&gt; <a href="http://www.ibm.com/developerworks/java/library/j-jtp01255.html" target="_blank">http://www.ibm.com/developerworks/java/library/j-jtp01255.html</a>). &nbsp;I<br>
&gt; somehow don&#39;t see this discussion in Haskell. &nbsp; I wonder if haskell&#39;s<br>
&gt; model of letting the caller determine the result type has advantage in<br>
&gt; that you don&#39;t have all the complexity you would have if you let the<br>
&gt; API determine their types.<br>
<br>
</div>These look more like unfortunate interactions between generics and the<br>
pre-existing Java language than anything else. &nbsp;Covariance isn&#39;t really<br>
an issue in Haskell, since Haskell lacks sub-typing; the various<br>
unfortunate consequences of type erasure in Java are avoided by the fact<br>
that Haskell types lack constructors, so the user never expects to be<br>
able to conjure up a value of an unknown type.<br>
<br>
jcc<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>
</div>