[Haskell-cafe] Re: Equality constraints and RankNTypes - how do I assist type inference

DavidA polyomino at f2s.com
Sat Aug 21 03:15:16 EDT 2010

Brandon S Allbery KF8NH <allbery <at> ece.cmu.edu> writes:

> > type Tensor u v =
> >     (u ~ Vect k a, v ~ Vect k b) => Vect k (TensorBasis a b) -- **
> IIRC this actually substitutes as
>   (forall k a b. (u ~ Vect k a, v ~ Vect k b) => Vect k (TensorBasis a b))
> and the implicit forall will generally mess things up because it won't be
> floated out to the top level.  (Or in other words, constraints in type
> declarations don't generally do what you intend.)

Thanks. Is it possible to elaborate a bit - I still don't really understand
what goes wrong. And is there any way to fix it?

More information about the Haskell-Cafe mailing list