[Haskell] type family vs. polymorphism

Simon Peyton-Jones simonpj at microsoft.com
Tue Jan 13 06:51:14 EST 2009


[Redirecting to GHC users]

Andres,

Nice example.  It's another instance of a problem that keeps coming up with type families.  Details here: http://hackage.haskell.org/trac/ghc/ticket/1897#comment:10

The rest of the ticket gives other examples.  It's not clear what the Right Thing to do is.

Simon

| -----Original Message-----
| From: haskell-bounces at haskell.org [mailto:haskell-bounces at haskell.org] On Behalf Of Andres
| Loeh
| Sent: 12 January 2009 21:44
| To: haskell at haskell.org
| Subject: [Haskell] type family vs. polymorphism
|
| Hi.
|
| Here's a strange interaction of type families and higher-rank
| polymorphism (tested with both ghc-6.8.3 and ghc-6.10.1):
|
| {-# LANGUAGE TypeFamilies, EmptyDataDecls, RankNTypes #-}
|
| data X (a :: *)
| type family Y (a :: *)
|
| -- This works (datatype).
| i1 :: (forall a. X a) -> X Bool
| i1 x = x
|
| -- This works too (type family and extra arg).
| i2 :: (forall a. a -> Y a) -> Y Bool
| i2 x = x True
|
| -- This doesn't work (type family).
| -- i3 :: (forall a. Y a) -> Y Bool
| -- i3 x = x
|
| I would expect i3 to be ok as well. Note that this is a
| simplified example and not really useful in its simplified
| form.
|
| Cheers,
|   Andres
|
| --
|
| Andres Loeh, Universiteit Utrecht
|
| mailto:andres at cs.uu.nl     mailto:mail at andres-loeh.de
| http://www.andres-loeh.de
| _______________________________________________
| Haskell mailing list
| Haskell at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell



More information about the Glasgow-haskell-users mailing list