
2 Jan
2003
2 Jan
'03
6:18 p.m.
G'day all. On Thu, Jan 02, 2003 at 05:49:41PM +0100, Ferenc Wagner wrote:
What's the way to express the following: a compound object is generally made up of two components with identical type.
This should work: \begin{code} module Test where class Component b where property :: b -> Int class (Component b) => Compound a b | a -> b where decompose :: a -> (b,b) additive :: a -> Int additive x = property l + property r where (l,r) = decompose x \end{code} Cheers, Andrew Bromage