Hal Daume III <[EMAIL PROTECTED]> writes:
> I'd like to be able to define something like
>
> instance Eq a => Coll (-> Bool) a where
> empty = \_ -> False
> single x = \y -> if x == y then True else False
> union a b = \x -> a x || b x
> insert s x = \y -> x == y || s y
I don't know what Coll is, but the following is working:
class Collection e ce | ce -> e where
empty :: ce
insert :: e -> ce -> ce
member :: e -> ce -> Bool
instance Eq a => Collection a (a -> Bool) where
empty = (\x -> False)
insert e f = (\x -> if x == e then True else f x)
member e f = f e
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell