summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2008-10-09 06:14:35 +0000
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2008-10-09 06:14:35 +0000
commit1ae354e107715a9e3fd4e2d67b61f868c090e4ae (patch)
tree89d4ed56ecea47d28196a79d8f9dbc1278ad13c0
parentd64994a1678e055e886d245a3184531be311737f (diff)
downloadhaskell-1ae354e107715a9e3fd4e2d67b61f868c090e4ae.tar.gz
Cover PredTy case in Type.tyFamInsts
MERGE TO 6.10
-rw-r--r--compiler/types/Type.lhs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs
index 07e61daf00..cf38146eb1 100644
--- a/compiler/types/Type.lhs
+++ b/compiler/types/Type.lhs
@@ -44,7 +44,7 @@ module Type (
newTyConInstRhs,
-- (Type families)
- tyFamInsts,
+ tyFamInsts, predFamInsts,
-- (Source types)
mkPredTy, mkPredTys, mkFamilyTyConApp,
@@ -887,6 +887,14 @@ tyFamInsts (TyConApp tc tys)
tyFamInsts (FunTy ty1 ty2) = tyFamInsts ty1 ++ tyFamInsts ty2
tyFamInsts (AppTy ty1 ty2) = tyFamInsts ty1 ++ tyFamInsts ty2
tyFamInsts (ForAllTy _ ty) = tyFamInsts ty
+tyFamInsts (PredTy pty) = predFamInsts pty
+
+-- | Finds type family instances occuring in a predicate type after expanding
+-- synonyms.
+predFamInsts :: PredType -> [(TyCon, [Type])]
+predFamInsts (ClassP _cla tys) = concat (map tyFamInsts tys)
+predFamInsts (IParam _ ty) = tyFamInsts ty
+predFamInsts (EqPred ty1 ty2) = tyFamInsts ty1 ++ tyFamInsts ty2
\end{code}