[Haskell-cafe] [Newbie] Quest for inheritance

Cédric Paternotte cpaternotte at gmail.com
Mon Jun 6 18:35:55 EDT 2005


Hi Ralf,

> I should have mentioned
> http://homepages.cwi.nl/~ralf/OOHaskell/src/PoorMens2/
> (again *not* using OOHaskell)
> 

It's been an interesting evening. I've been having a go at your
poormen's source code and, although it's different from OOHaskell, I
still find it very similar in the sense that it's using the same
concepts, namely infix operators (for syntactic sugar I assume) and
state monads (for mutable data). But I had a look at it anyway  ;)

>From what I gathered today infix operators are just like ordinary
functions, that differ only in the way you pass them parameters. I
understand the .?. and .!. operators in your code are shortcuts that
apply a function to the parent type, respectively for get and set
operations.

The only thing I couldn't figure is the reason of using monads. I
noticed they (returnIO) were extensively used in the setters and in
the .!. operator. Do monads provide features without which this whole
thing wouldn't be possible ? What is it exactly they provide in this
context ?

> A more general and preliminary observation:
> the entire approach is potentially more about
> object *composition* (and perhaps delegation)
> rather than inheritance. 

That's also the way I see it.

Cédric


More information about the Haskell-Cafe mailing list