<br><br><div class="gmail_quote">On Sun, Nov 1, 2009 at 2:00 AM, Michael Vanier <span dir="ltr"><<a href="mailto:mvanier42@gmail.com">mvanier42@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Gregory Collins wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Tom Davie <<a href="mailto:tom.davie@gmail.com" target="_blank">tom.davie@gmail.com</a>> writes:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 10/31/09, Magicloud Magiclouds <<a href="mailto:magicloud.magiclouds@gmail.com" target="_blank">magicloud.magiclouds@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
After all, I never think OO as an oppsite way to all other things. The<br>
idea is so general that if you say I cannot use it in Haskell at all,<br>
that would make me feel weird. The only difference between languages<br>
is, some are easy to be in OO style, some are not.<br>
<br>
</blockquote>
Wow, someone drank the cool aid!<br>
<br>
</blockquote>
<br>
Doing OO-style programming in Haskell is difficult and unnatural, it's<br>
true (although technically speaking it is possible). That said, nobody's<br>
yet to present a convincing argument to me why Java gets a free pass for<br>
lacking closures and typeclasses.<br>
<br>
G.<br>
<br>
</blockquote></div>
Because most programmers have never heard of closures and typeclasses, and thus have no idea how useful they are? :-(<br>
<br>
BTW using existential types in Haskell you can mimic OO to a pretty decent degree, at least as far as interfaces are concerned.<br></blockquote><div><br></div><div>I kind of wish we had some convenience notation for doing value-based dispatch like that.... Something like</div>
<div><br></div><div>foo :: [ <Show> ] -> String</div><div>foo xs = concatMap show xs</div><div><br></div><div>> foo [ 5, True, 1.3 ]</div><div>"5True1.3"</div></div><div><br></div><div><br></div>(where wrapping a class up in angle brackets makes it into an existentially qualified wrapper, which is instantiated in the class itself -- maybe we need explicit conversion from e.g. Int to <Show> though...)<div>
<br></div><div>You don't need it very often, but I wonder if that's because there genuinely isn't a need, or if you tend to avoid writing code in ways which would need it (ask a Java programmer, and they'll probably tell you that the need for type classes and closures don't come up very often - which is clearly untrue for a Haskell programmer).<br clear="all">
<br>-- <br>Sebastian Sylvan<br>
</div>