RE: forall and class contexts
| I want to define something like | class (Eq (forall a. T a), Monad T) => C T | where the context shall mean that T has to be an instance of Monad and | that for every type a the type T a has to be an instance of Eq. | Is such a thing possible with some Haskell implementation? Not currently, but I think it makes sense, and I'll implement it if enough people ask. Presumably you mean 'instance' not 'class'? A class decl always has a type variable after the =>; thus ...=> C a. There aren't many type constructors T for which T a is an equality type... Simon
G'day all. On Wed, Oct 16, 2002 at 08:40:18AM +0100, Simon Peyton-Jones wrote:
There aren't many type constructors T for which T a is an equality type...
I can think of a few, like IORef. Admittedly I can't think of any that are also monads. Cheers, Andrew Bromage
participants (2)
-
Andrew J Bromage -
Simon Peyton-Jones