forall and class contexts
Wolfgang Jeltsch
wolfgang@jeltsch.net
16 Oct 2002 18:26:40 +0200
On Wednesday, 2002-10-16, 09:40, CEST, Simon Peyton-Jones wrote:
> > 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.
Hello again,
I mean "class" but I have made a mistake in the code above: The
uppercase T should be a lowercase t.
> There aren't many type constructors T for which T a is an equality
> type...
I only wanted to illustrate what kind of construction I'd like to have
by using standard Haskell classes. In my application I don't use Eq.
> Simon
Wolfgang