23 Apr
2002
23 Apr
'02
midnight
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.