[commit: ghc] master: Simplify TcSMonad.matchFam's interface (882e439)
Simon Peyton Jones
simonpj at microsoft.com
Wed Aug 3 17:23:43 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/882e439b80110917b83aaaae3cf88fdb4ef3bd6a
>---------------------------------------------------------------
commit 882e439b80110917b83aaaae3cf88fdb4ef3bd6a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Aug 3 16:18:53 2011 +0100
Simplify TcSMonad.matchFam's interface
>---------------------------------------------------------------
compiler/typecheck/TcInteract.lhs | 8 +++-----
compiler/typecheck/TcSMonad.lhs | 13 ++-----------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs
index 457715f..96d452a 100644
--- a/compiler/typecheck/TcInteract.lhs
+++ b/compiler/typecheck/TcInteract.lhs
@@ -1827,10 +1827,10 @@ doTopReact _inerts (CFunEqCan { cc_flavor = fl })
doTopReact _inerts workItem@(CFunEqCan { cc_id = cv, cc_flavor = fl
, cc_fun = tc, cc_tyargs = args, cc_rhs = xi })
= ASSERT (isSynFamilyTyCon tc) -- No associated data families have reached that far
- do { match_res <- matchFam tc args -- See Note [MATCHING-SYNONYMS]
+ do { match_res <- matchFam tc args -- See Note [MATCHING-SYNONYMS]
; case match_res of
- MatchInstNo -> return NoTopInt
- MatchInstSingle (rep_tc, rep_tys)
+ Nothing -> return NoTopInt
+ Just (rep_tc, rep_tys)
-> do { let Just coe_tc = tyConFamilyCoercion_maybe rep_tc
Just rhs_ty = tcView (mkTyConApp rep_tc rep_tys)
-- Eagerly expand away the type synonym on the
@@ -1864,8 +1864,6 @@ doTopReact _inerts workItem@(CFunEqCan { cc_id = cv, cc_flavor = fl
, tir_new_inert = Stop }
}
}
- _
- -> panicTcS $ text "TcSMonad.matchFam returned multiple instances!"
}
diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs
index 39f3c4b..f444adc 100644
--- a/compiler/typecheck/TcSMonad.lhs
+++ b/compiler/typecheck/TcSMonad.lhs
@@ -941,15 +941,6 @@ matchClass clas tys
}
}
-matchFam :: TyCon
- -> [Type]
- -> TcS (MatchInstResult (TyCon, [Type]))
-matchFam tycon args
- = do { mb <- wrapTcS $ TcM.tcLookupFamInst tycon args
- ; case mb of
- Nothing -> return MatchInstNo
- Just res -> return $ MatchInstSingle res
- -- DV: We never return MatchInstMany, since tcLookupFamInst never returns
- -- multiple matches. Check.
- }
+matchFam :: TyCon -> [Type] -> TcS (Maybe (TyCon, [Type]))
+matchFam tycon args = wrapTcS $ TcM.tcLookupFamInst tycon args
\end{code}
More information about the Cvs-ghc
mailing list