<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"><<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>></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>
> The equivalent won't compile in Haskell, because the actual<br>
> return<br>
> type does matter, and *is determined by the calling code*.<br>
> Our<br>
> fictional GetListOfData can't return a List or a Mylist<br>
> depending on<br>
> some conditional, in fact it can't explicitly return either<br>
> one at<br>
> all, because the actual type of the result, as determined by<br>
> the<br>
> caller, could be either one, or something else entirely<br>
> (ignoring the<br>
> IO bit for the time being).<br>
><br>
><br>
> I have had an unresolved issue on my stack of Haskell vs Java that I<br>
> wonder if your observation explains.<br>
><br>
> If you notice java generics has all sort of gotchas (e.g.<br>
> <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>). I<br>
> somehow don't see this discussion in Haskell. I wonder if haskell's<br>
> model of letting the caller determine the result type has advantage in<br>
> that you don't have all the complexity you would have if you let the<br>
> 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. Covariance isn'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>