# defining (-> Bool) as a set

**Pixel
**
[email protected]

*23 Apr 2002 01:36:25 +0200*

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