[Haskell-cafe] Type families and polymorphism

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Jul 11 17:01:35 EDT 2009

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) you can produce *any* type (TF a) (because of the  
delimited forall-s), but then the code asserts that they are the same  

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090711/9018cfb7/PGP.bin

More information about the Haskell-Cafe mailing list