
9 Dec
2010
9 Dec
'10
7:27 p.m.
We can use a standard trick for poly-variadic functions. {-# LANGUAGE FlexibleInstances #-} class PolyDisj t where disj :: Bool -> t instance PolyDisj Bool where disj x = x instance PolyDisj t => PolyDisj (Bool -> t) where disj x y = disj (x || y) And a test: *Main> disj False False False :: Bool False *Main> disj False False False True :: Bool True You need to somehow give the expression a type otherwise it won't know which instance to use. Edward