> 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

This is way better than my solution... 

I had never used multi-parameter classes before, so I forgot the functional 
dependency (right name? the "|ce->e"), and there was obviously no need for my 
extra constructor.

J.A.
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to