Skip to content
  • Simon Peyton Jones's avatar
    Kind variables in RHS of an associated type instances should be bound on LHS · 171101be
    Simon Peyton Jones authored
    This patche fixes Trac #9574.
    
    The previous Note [Renaming associated types] in RnTypes appears to me to be wrong;
    it confused class and instance declarations.
    
    I have:
    
     * Treated kind and type variables uniformly. Both must be bound on the LHS
       of an associated type instance.  Eg
           instance C ('KProxy :: KProxy o) where
              type F 'KProxy = NatTr (Proxy :: o -> *)
       is illegal because 'o' is not bound on the LHS of the instance.
    
     * Moved the Note to RnSource and fixed it up
    
    This improves the error message from T7938. However it made the code in
    T6118 incorrect. We had:
      instance SingE (a :: Maybe k) where
        type Demote a = Maybe (Demote (Any :: k))
    and that is now rejected, rightly I think.
    171101be