Major change in compilation of instance declarations (fix Trac #955, #2328)
[ghc-hetmet.git] / compiler / deSugar / DsBinds.lhs
index 3df57d7..764e44b 100644 (file)
@@ -587,8 +587,11 @@ dsCoercion (WpLam id)        thing_inside = do { expr <- thing_inside
                                               ; return (Lam id expr) }
 dsCoercion (WpTyLam tv)      thing_inside = do { expr <- thing_inside
                                               ; return (Lam tv expr) }
-dsCoercion (WpApp id)        thing_inside = do { expr <- thing_inside
-                                              ; return (App expr (Var id)) }
+dsCoercion (WpApp v)         thing_inside   
+          | isTyVar v                    = do { expr <- thing_inside
+               {- Probably a coercion var -}  ; return (App expr (Type (mkTyVarTy v))) }
+          | otherwise                    = do { expr <- thing_inside
+               {- An Id -}                    ; return (App expr (Var v)) }
 dsCoercion (WpTyApp ty)      thing_inside = do { expr <- thing_inside
                                               ; return (App expr (Type ty)) }
 dsCoercion WpInline         thing_inside = do { expr <- thing_inside