[Haskell-cafe] Issues(Bugs?) with GHC Type Families
hpacheco at gmail.com
Mon Mar 3 12:35:06 EST 2008
I have recently tried to replicate some examples from in the articles about
type families but found some possible bugs.
In , the example
class C a where
type S a (k :: * -> *) :: *
instance C [a] where
type S [a] k = (a,k a)
does not compile under the claim that the type variable k is not in scope.
However, if we extract the type family from the class
type family S a (k :: * -> *) :: *
type instance S [a] k = (a, k a)
class C a
it compiles correctly.
According to , the difference is purely syntactic sugar, does that mean
that both examples should compile and behave the same or is there some
subtlety that justifies the class example not to compile?
Another issue is that data kinds (used in both  and ) do not seem to
be supported at all by the compiler, are they already implemented in GHC?
Simple examples such as
datakind Nat = Zero
datakind Nat = Zero | Succ Nat
fail to compile.
Perhaps some of these should be submitted to the GHC Bug Tracker. I have
tested both GHC 6.8.2 and 6.9.20080218.
1. Associated Types with
M. T. Chakravarty, Gabriele Keller, Simon Peyton Jones, and Simon Marlow.
In *Proceedings of The 32nd Annual ACM SIGPLAN-SIGACT Symposium on
Principles of Programming Languages (POPL'05)*, pages 1-13, ACM Press,
2. Associated Type
M. T. Chakravarty, Gabriele Keller, and Simon Peyton Jones. In *Proceedings
of The Tenth ACM SIGPLAN International Conference on Functional Programming
*, ACM Press, pages 241-253, 2005.
3. Towards Open Type Functions for
Schrijvers, Martin Sulzmann, Simon Peyton-Jones, and Manuel M. T.
Chakravarty. Unpublished manuscript, 2007.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe