[Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?

Andrew Coppin andrewcoppin at btinternet.com
Fri Oct 30 15:04:30 EDT 2009

Rogan Creswick wrote:
> On Thu, Oct 29, 2009 at 6:54 PM, Magicloud Magiclouds
> <magicloud.magiclouds at gmail.com> wrote:
>>  My concern here is about the data member inheriting. In OOP, when I
>> inherit a class, I also got the members of it. But in haskell, how to
>> inherit a "data"?
> In my experience (almost entirely with Java), it is usually a bad idea
> to inherit from a class in order to reuse data storage that the parent
> class provides.  Encapsulation (or a decorator, if you prefer) is
> often a safer choice.

...otherwise phrased in OO circles as "people over-use inheritance and
under-use collaboration".

That said, I'm sure I won't be the first person here to say that
generally, if you want to write a Haskell program, you should forget all
about OOP and figure out how to structure it to make the best use of
Haskell. It's a very different approach to program construction, and it
requires a different way of thinking.

More information about the Haskell-Cafe mailing list