Restricted Data Types

Ben Rudiak-Gould Benjamin.Rudiak-Gould at
Tue Feb 7 15:47:27 EST 2006

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

More information about the Haskell-prime mailing list