Steve Downey wrote: 
 > So, I've been working on a Composite example. I've used
 > existential types to have a generic proxy to the base
 > type, rather than a simple algebraic type, since adding
 > new leaves to the algebraic type means modifying the whole
 > type, a violation of the Open-Closed principle (open for
 > extension, closed for modification)

Rather than using existential types, a simple record of
functions can be often be useful. ie:

data Component = Component {
    draw :: String
    add  :: Component -> Component
}

It might be worth comparing this approach with the (more
complex) one you have described.

Tim
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to