X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcArrows.lhs;h=538eaa7c91c75abd77b2539cacee8576c8c86df8;hb=640872cbcc1c56b5c80cc9b8635ffca851a0cea8;hp=0055d6453feb9f0f60fe7f8a2f8aca2cfae322ac;hpb=6a05ec5ef5373f61b7f9f5bdc344483417fa801b;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcArrows.lhs b/compiler/typecheck/TcArrows.lhs index 0055d64..538eaa7 100644 --- a/compiler/typecheck/TcArrows.lhs +++ b/compiler/typecheck/TcArrows.lhs @@ -42,6 +42,8 @@ import Type import SrcLoc import Outputable import Util + +import Control.Monad \end{code} %************************************************************************ @@ -60,7 +62,7 @@ tcProc pat cmd exp_ty do { ((exp_ty1, res_ty), coi) <- boxySplitAppTy exp_ty ; ((arr_ty, arg_ty), coi1) <- boxySplitAppTy exp_ty1 ; let cmd_env = CmdEnv { cmd_arr = arr_ty } - ; (pat', cmd') <- tcLamPat pat arg_ty (emptyRefinement, res_ty) $ + ; (pat', cmd') <- tcProcPat pat arg_ty (emptyRefinement, res_ty) $ tcCmdTop cmd_env cmd [] ; let res_coi = mkTransCoI coi (mkAppTyCoI exp_ty1 coi1 res_ty IdCo) ; return (pat', cmd', res_coi) @@ -128,12 +130,11 @@ tc_cmd env (HsLet binds (L body_loc body)) res_ty ; return (HsLet binds' (L body_loc body')) } tc_cmd env in_cmd@(HsCase scrut matches) (stk, res_ty) - = addErrCtxt (cmdCtxt in_cmd) $ - addErrCtxt (caseScrutCtxt scrut) ( - tcInferRho scrut - ) `thenM` \ (scrut', scrut_ty) -> - tcMatchesCase match_ctxt scrut_ty matches res_ty `thenM` \ matches' -> - returnM (HsCase scrut' matches') + = addErrCtxt (cmdCtxt in_cmd) $ do + (scrut', scrut_ty) <- addErrCtxt (caseScrutCtxt scrut) $ + tcInferRho scrut + matches' <- tcMatchesCase match_ctxt scrut_ty matches res_ty + return (HsCase scrut' matches') where match_ctxt = MC { mc_what = CaseAlt, mc_body = mc_body } @@ -272,7 +273,7 @@ tc_cmd env cmd@(HsArrForm expr fixity cmd_args) (cmd_stk, res_ty) -- the s1..sm and check each cmd ; cmds' <- mapM (tc_cmd w_tv) cmds_w_tys - ; returnM (HsArrForm (noLoc $ HsWrap (WpTyLam w_tv) + ; return (HsArrForm (noLoc $ HsWrap (WpTyLam w_tv) (unLoc $ mkHsDictLet inst_binds expr')) fixity cmds') }