[Haskell-cafe] Re: OO Design in Haskell Example (Draft)

Tim Docker twd_gg at dockerz.net
Tue Feb 27 00:15:06 EST 2007


Steve Downey wrote:
> interesting. it leads to something that feels much more like an object
based, as opposed to a class based, system.
> as far as haskell is concerned, everything has the same type, even
though different instances have very different behavior.
> ....
> the question is, which plays nicer with the rest of haskell? that is, if
i'm not committing to a closed dsl, which style is more likely to be
reusable against other libraries.

I suspect there's no right answer - it's a case of choosing the
best approach for the problem. As an example, my charting library
(http://dockerz.net/software/chart.html) uses the record of functions
approach for composing drawings:

data Renderable = Renderable {
    minsize :: (Render RectSize)
    render :: (Rect -> Render ())
}

Tim






More information about the Haskell-Cafe mailing list