[Haskell-cafe] What Object Oriented Paradigms Does Haskell Support?

John Creighton johns243a at gmail.com
Sat May 15 16:10:55 EDT 2010


In response to the discussion

What makes Haskell difficult as .NET?
http://groups.google.ca/group/haskell-cafe/browse_thread/thread/f61ee38f2082dcbe?hl=en#

I thought I'd start a discussion on what object oriented features
Haskell supports.

A good reference is:
Haskell's Overlooked Object System
http://homepages.cwi.nl/~ralf/OOHaskell/paper.pdf

The comparison is often made of Haskell's classes to interface.
However, once we define an instance we have something concrete which
is closer to a class under the object oriented paradigm. If our
instances are paramatric:

MyType a = MyType{.......child::a}

Then when we can create subclass instances which are sybtypes of our
Paramatric type. This gives us inheritance. Overriding might be
slightly trickier. We can certainly create new instances of the parent
class for a specific subtype. As a minimum we will need to specify
each method we created which is not defined in terms of the others
(our getters and setters) and perhaps we are allowed to over ride the
methods which are derived from the other methods. Anyway, I'll do some
re reading of the paper, experiment with some code and see what other
options there are.



More information about the Haskell-Cafe mailing list