Stephen,<br><br>I see your point, and I am not a fan of OO style programming in Haskell. I just wanted to answer OP&#39;s question.<br><br>In OOP you can have a list of objects of different types, provided they are subclasses of a common class. But then. you can only apply methods of the base class to the elements of this list. (Yes you can do some fiddling to recover the actual type of an element, but you can do similar things in Haskell as well)<br>
<br>If you desperately want to achieve this effect in Haskell, you can. But there most probably are better ways of doing things idiomatically.<br><br>Best,<br>Ozgur<br><br><div class="gmail_quote">On 26 August 2010 13:16, Stephen Tetley <span dir="ltr">&lt;<a href="mailto:stephen.tetley@gmail.com">stephen.tetley@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">On 26 August 2010 11:51, Ozgur Akgun &lt;<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>&gt; wrote:<br>

[SNIP]<br>
<div class="im">&gt;<br>
&gt; But that&#39;s because you use Show while defining the Obj data type. You can<br>
&gt; implement other functionalities, by introducing a custom type class, and<br>
&gt; implementing functionalities in instance declarations.<br>
&gt;<br>
<br>
</div>Hi Ozgur<br>
<br>
This is well known, of course, Ralf Lammel (umlauts on the a in<br>
Lammel) and Klaus Ostermann have a catalogue of &quot;shoehorns&quot; to fit OO<br>
design into Haskell:<br>
<br>
<a href="http://homepages.cwi.nl/%7Eralf/gpce06/paper.pdf" target="_blank">http://homepages.cwi.nl/~ralf/gpce06/paper.pdf</a><br>
<br>
However these styles aren&#39;t exemplary [*] - little Haskell code that<br>
I&#39;ve seen in the wild makes use of them. For instance, having a type<br>
class for each operation as per CustomTC seems exorbitant, likewise<br>
adding type class contexts to datatype definitions quickly becomes<br>
unwieldy:<br>
<br>
data Obj = forall a. (Show a, AquaticLifeform a, ...) =&gt; Obj a<br>
<br>
Best wishes<br>
<br>
Stephen<br>
<br>
<br>
[*] Caveat - Figure 16 is quite reminiscent of the &quot;finally tagless&quot;<br>
style which is now widely used.<br>
<div><div></div><div class="h5">_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br>