[Haskell-cafe] Type families and polymorphism
Roman Cheplyaka
roma at ro-che.info
Sat Jul 11 17:54:13 EDT 2009
* Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> [2009-07-11 17:01:35-0400]
> On Jul 11, 2009, at 14:31 , Jeremy Yallop wrote:
>> Why does compiling the following program give an error?
>>
>>> {-# LANGUAGE TypeFamilies, RankNTypes #-}
>>>
>>> type family TF a
>>>
>>> identity :: (forall a. TF a) -> (forall a. TF a)
>>> identity x = x
>
>
> The scope of each a is the surrounding parentheses, so the de facto type
> is TF a -> TF b. Or, put otherwise, you're saying that for *any* type (TF
> a)
No, for any (forall a. TF a), which should make the difference.
> you can produce *any* type (TF a) (because of the delimited forall-s),
> but then the code asserts that they are the same type.
--
Roman I. Cheplyaka :: http://ro-che.info/
"Don't let school get in the way of your education." - Mark Twain
More information about the Haskell-Cafe
mailing list