X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcArrows.lhs;h=8b74063af2a003279235cdfec9f140e4de1298f7;hb=550bd53be2ca1241a46517187d64fb0d077aeda0;hp=52b22cf8e7e2749f42f810b61c6c09c68da051ec;hpb=e9efdf979386e596394aee9984593d518866fe41;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcArrows.lhs b/compiler/typecheck/TcArrows.lhs index 52b22cf..8b74063 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} %************************************************************************ @@ -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 } @@ -174,7 +175,6 @@ tc_cmd env cmd@(HsArrApp fun arg _ ho_app lr) (cmd_stk, res_ty) tc_cmd env cmd@(HsApp fun arg) (cmd_stk, res_ty) = addErrCtxt (cmdCtxt cmd) $ --- gaw 2004 FIX? do { arg_ty <- newFlexiTyVarTy openTypeKind ; fun' <- tcCmd env fun (arg_ty:cmd_stk, res_ty) @@ -272,7 +272,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') }