[Haskell-cafe] Re: Equality constraints and RankNTypes - how do
I assist type inference
Sjoerd Visscher
sjoerd at w3future.com
Sat Aug 21 05:39:55 EDT 2010
This works:
-- Tensor product of two vector spaces
type family Tensor u v :: *
type instance Tensor (Vect k a) (Vect k b) = Vect k (TensorBasis a b)
On Aug 21, 2010, at 9:15 AM, DavidA wrote:
> 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?
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Sjoerd Visscher
http://w3future.com
More information about the Haskell-Cafe
mailing list