
27 Nov
2009
27 Nov
'09
10:34 a.m.
Hello, I have a type family and a type class:
type family ErrorAlg (f :: (* -> *) -> * -> *) e ix :: *
class MkErrorAlg f where mkErrorAlg :: ErrorAlg f e a -> f (K0 a) ix -> Either e a
Instances for these two really go hand in hand, so I thought I would move the type family into the type class. However, this causes GHC to complain about the type variables that are bound on the LHS of the type synonym:
Not in scope: type variable `e' Not in scope: type variable `ix'
In function types, using new type variables (i.e. type variables not bound by the type class header) implicitly means universal quantification over these variables. Why is this disallowed in type families inside type classes? Thanks, Martijn.