Joel Reymont <[EMAIL PROTECTED]> writes: > Support I want to infer the type given an Op that looks like > this (incomplete): > > data Op > = Minus > | Plus > | Mul > | LT > | GT > > Is there a shorthand way of bunching Minus, Plus and Mul in > a function guard since they all result in TyNum whereas the > rest in TyBool? > > I really don't want several function clauses and neither do > I want separate guards for every constructor.
Is there some reason why you don't want data Op = Aop Aop | Bop Bop data Aop = Minus | Plus | Mul data Bop = LT | GT or similar? I would agree that it's a shame one cannot just write data Op = Aop (Minus | Plus | Mul) | Bop (LT | GT) or even, given a somewhat different type system, data Op = Aop | Bop where Aop = Minus | Plus | Mul Bop = LT | GT but it would seem reasonable to reflect the different types of the Ops in different types in their representations. -- Jón Fairbairn [EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe