Commit 45b39102 authored by bringert@cs.chalmers.se's avatar bringert@cs.chalmers.se
Browse files

Instantiate data constructor type variables with the type constructor type...

Instantiate data constructor type variables with the type constructor type variables in constraints for derived class instances. Fixes instance deriving for GADTs which declar H98 types, closing ticket #902.
parent d8cd5045
......@@ -31,10 +31,10 @@ import RnEnv ( bindLocalNames )
import HscTypes ( FixityEnv )
import Class ( className, classArity, classKey, classTyVars, classSCTheta, Class )
import Type ( zipOpenTvSubst, substTheta, pprThetaArrow, pprClassPred )
import Type ( zipOpenTvSubst, substTheta, pprThetaArrow, pprClassPred, mkTyVarTy )
import ErrUtils ( dumpIfSet_dyn )
import MkId ( mkDictFunId )
import DataCon ( isNullarySrcDataCon, isVanillaDataCon, dataConOrigArgTys )
import DataCon ( isNullarySrcDataCon, isVanillaDataCon, dataConOrigArgTys, dataConInstOrigArgTys )
import Maybes ( catMaybes )
import RdrName ( RdrName )
import Name ( Name, getSrcLoc )
......@@ -568,7 +568,7 @@ mkDataTypeEqn tycon clas
ordinary_constraints
= [ mkClassPred clas [arg_ty]
| data_con <- tyConDataCons tycon,
arg_ty <- dataConOrigArgTys data_con,
arg_ty <- dataConInstOrigArgTys data_con (map mkTyVarTy (tyConTyVars tycon)),
not (isUnLiftedType arg_ty) -- No constraints for unlifted types?
]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment