I just started reading "Haskell's overlooked object system".
The survey of existing object encodings looks like a good place to start, although for several, where Either is used as a union type there are some rather obvious scaling problems. <g>

If I've understood it, the OOHaskell library is meant to be a way of exploring OO in Haskell. Is it something that should be used by someone who wants to implement an OO design today? Or is it more for someone interested in research into the best way of doing OO in a functional context?

I agree that there are a number of thorny OO issues, particularly that there really isn't a single OO model, rather a number of related models, practices and principles that are all lumped into the context of OO. Not to mention the tension between a model that revolves around mutable state against a system built on referential transparency.

Mostly, I'd like to see better answers to questions like 'how do I do this' than here's something that will let you build something that lets you do that. I tend towards the engineering / reduction to practice side of things. Much as I like theory. And even if the answer is, there isn't really a best answer, but here are two or three reasonably good ways that won't cause too much trouble, and here's the kind of trouble they are likely to cause.


On 2/26/07, oleg@pobox.com <oleg@pobox.com> wrote:

Steve Downey wrote:
> In the last OO design in Haskell thread (and probably in every one
> preceeding it), it was suggested that having some examples might be a good
> idea.
>
> Since most people with existing designs will have some familiarity with
> Design Patterns, and those are typical building blocks for OO designs, it
> occured to me that implementing some of them might be a useful
> excersize.

Have you looked at OOHaskell?
         http://homepages.cwi.nl/~ralf/OOHaskell/
        http://darcs.haskell.org/OOHaskell/

With the exception of pure-functional objects and binary methods, I
think we have considered almost every OO pattern/idiom we could find,
including nominal/structural subtyping, co- and contra-variance,
self-typing, etc. The DARCS repository contains the complete code for
all of the examples and patterns. To clarify, the point of OOHaskell
is to use Haskell as a tool, laboratory bench, for exploring various
(thorny) OO issues.