<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&#39;t compile in Haskell, because the actual return<br>
type does matter, and *is determined by the calling code*. &nbsp;Our<br>
fictional GetListOfData can&#39;t return a List or a Mylist depending on<br>
some conditional, in fact it can&#39;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&nbsp; unresolved issue on my stack of Haskell vs Java that I wonder if your observation explains.<br><br>If you notice&nbsp; 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>).&nbsp; I somehow don&#39;t see this discussion in Haskell.&nbsp;&nbsp; I wonder if haskell&#39;s model of letting the caller determine the result type has advantage in that you don&#39;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">&lt;<a href="mailto:monnier@iro.umontreal.ca">monnier@iro.umontreal.ca</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">&gt; The instance selection for an interface is done at run-time and this is<br>
&gt; inherently necessary. &nbsp;The instance (in a different sense) selection for<br>
&gt; type classes is almost always resolvable statically. &nbsp;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>
 &nbsp; &nbsp; &nbsp; &nbsp;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>