Commit 41d29d5a authored by Simon Peyton Jones's avatar Simon Peyton Jones

Comments only

parent 4aa98f4a
......@@ -727,19 +727,25 @@ check_pred_help under_syn env dflags ctxt pred
| Just pred' <- tcView pred -- Switch on under_syn when going under a
-- synonym (Trac #9838, yuk)
= check_pred_help True env dflags ctxt pred'
| otherwise
| otherwise -- A bit like classifyPredType, but not the same
-- E.g. we treat (~) like (~#); and we look inside tuples
= case splitTyConApp_maybe pred of
Just (tc, tys)
| isTupleTyCon tc
-> check_tuple_pred under_syn env dflags ctxt pred tys
-- NB: this equality check must come first, because (~) is a class,
-- too.
| tc `hasKey` heqTyConKey ||
tc `hasKey` eqTyConKey ||
tc `hasKey` eqPrimTyConKey
-- NB: this equality check must come first,
-- because (~) is a class,too.
-> check_eq_pred env dflags pred tc tys
| Just cls <- tyConClass_maybe tc
-> check_class_pred env dflags ctxt pred cls tys -- Includes Coercible
-- Includes Coercible
-> check_class_pred env dflags ctxt pred cls tys
_ -> check_irred_pred under_syn env dflags ctxt pred
check_eq_pred :: TidyEnv -> DynFlags -> PredType -> TyCon -> [TcType] -> TcM ()
......
......@@ -1750,6 +1750,10 @@ eqRelRole ReprEq = Representational
data PredTree = ClassPred Class [Type]
| EqPred EqRel Type Type
| IrredPred PredType
-- NB: There is no TuplePred case
-- Tuple predicates like (Eq a, Ord b) are just treated
-- as ClassPred, as if we had a tuple class with two superclasses
-- class (c1, c2) => (%,%) c1 c2
classifyPredType :: PredType -> PredTree
classifyPredType ev_ty = case splitTyConApp_maybe ev_ty of
......
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