diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-03 16:18:53 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-08-03 16:18:53 +0100 |
commit | 882e439b80110917b83aaaae3cf88fdb4ef3bd6a (patch) | |
tree | d06273d429c8136f3014fe1652db0bfa20f5f311 | |
parent | 0d74feeac968276b1200ae392c3580520b5da1fe (diff) | |
download | haskell-882e439b80110917b83aaaae3cf88fdb4ef3bd6a.tar.gz |
Simplify TcSMonad.matchFam's interface
-rw-r--r-- | compiler/typecheck/TcInteract.lhs | 8 | ||||
-rw-r--r-- | 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 457715f3d9..96d452a1d5 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 39f3c4b216..f444adc924 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} |