+tc_cmd env (HsLet binds (L body_loc body)) res_ty
+ = do { (binds', body') <- tcLocalBinds binds $
+ setSrcSpan body_loc $
+ tc_cmd env 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 (Check res_ty) `thenM` \ matches' ->
+ returnM (HsCase scrut' matches')
+ where
+ match_ctxt = MC { mc_what = CaseAlt,
+ mc_body = mc_body }
+ mc_body body (Check res_ty') = tcCmd env body (stk, res_ty')