
29 Sep
2004
29 Sep
'04
9:48 a.m.
Hello! My question concerns a general term datatype: data Term = Not Term | Term :&&: Term | Term :||: Term | Literal Char Is it somehow possible to write a generic function that applies the associativity rules on a "Term" (by using pattern matching) and works with both data constructors or is it necessary to write one for :&&: and :||: ? Something like: assoc :: Term -> Term assoc ((t1 `op` t2) `op` t3) = .... -- this doesn't work Regards, Peter