[Haskell-cafe] [Newbie] Quest for inheritance
Ralf Lammel
ralfla at microsoft.com
Tue Jun 7 04:27:24 EDT 2005
Hi Gracjan,
> > http://homepages.cwi.nl/~ralf/OOHaskell/src/PoorMens2/
> > (again *not* using OOHaskell)
>
> From the quick skim of code:
> .?. -- apply function to upcast object
> .!. -- apply modification function to upcast object and substitute
> returned value (new object), basically update
Absolutely.
> Is there any description avaliable what is PoorMens2 all about?
Let me try.
It's just a variation on Chris' encoding of the shape example,
while trying to improve code reuse, while trying to highlight
the commonalities in the data parts of the objects in the inheritance
hierarchy. The approach ends up being similar to yours in so far
that getters (and setters) can be made work for derived types once
they are defined on the base type.
I just notice that there is a short (because non-monadic) version:
http://homepages.cwi.nl/~ralf/OOHaskell/src/PoorMens/
Ralf
More information about the Haskell-Cafe
mailing list