
7 Feb
2006
7 Feb
'06
8:47 p.m.
Simon Peyton-Jones wrote:
Another reasonable alternative is
data Set a = Eq a => Set (List a)
The type of member would become member :: a -> Set a -> Bool (with no Eq constraint).
John Hughes mentions this in section 5.2 of the paper, and points out a problem: a function like (singleton :: a -> Set a) would have to construct a dictionary out of nowhere. I think you need an Eq constraint on singleton, which means that you still can't make Set an instance of Monad. -- Ben