<div dir="ltr"><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
The equivalent won't compile in Haskell, because the actual return<br>
type does matter, and *is determined by the calling code*. Our<br>
fictional GetListOfData can't return a List or a Mylist depending on<br>
some conditional, in fact it can't explicitly return either one at<br>
all, because the actual type of the result, as determined by the<br>
caller, could be either one, or something else entirely (ignoring the<br>
IO bit for the time being).<br></blockquote><br><br>I have had an unresolved issue on my stack of Haskell vs Java that I wonder if your observation explains.<br><br>If you notice java generics has all sort of gotchas (e.g. <a href="http://www.ibm.com/developerworks/java/library/j-jtp01255.html">http://www.ibm.com/developerworks/java/library/j-jtp01255.html</a>). I somehow don't see this discussion in Haskell. I wonder if haskell's model of letting the caller determine the result type has advantage in that you don't have all the complexity you would have if you let the API determine their types.<br>
<br>daryoush<br><br><div class="gmail_quote">On Wed, Oct 15, 2008 at 11:45 AM, Stefan Monnier <span dir="ltr"><<a href="mailto:monnier@iro.umontreal.ca">monnier@iro.umontreal.ca</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">> The instance selection for an interface is done at run-time and this is<br>
> inherently necessary. The instance (in a different sense) selection for<br>
> type classes is almost always resolvable statically. In Haskell 98<br>
<br>
</div>In both cases, the dispatch is inherently dynamic, and in both cases,<br>
most dispatches can be resolved at compile-time with sufficient effort.<br>
The actual percentage may be quite different, tho.<br>
Implementation techniques are also fairly different, and the resulting<br>
coding style is also very different, but the two concepts are<br>
fundamentally very close to each other.<br>
<font color="#888888"><br>
<br>
Stefan<br>
</font><div><div></div><div class="Wj3C7c"><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>
</div></div></blockquote></div><br><br clear="all"><br><br>
</div>