= addErrCtxt (exprCtxt in_expr) $
tcHsSigType ExprSigCtxt poly_ty `thenM` \ sig_tc_ty ->
tcThingWithSig sig_tc_ty (tcCheckRho expr) res_ty `thenM` \ (co_fn, expr') ->
- returnM (co_fn <$> unLoc expr')
- -- ToDo: nasty unLoc
+ returnM (co_fn <$> ExprWithTySigOut expr' poly_ty)
tc_expr (HsType ty) res_ty
= failWithTc (text "Can't handle type argument:" <+> ppr ty)
tc_expr (HsProc pat cmd) res_ty
= tcProc pat cmd res_ty `thenM` \ (pat', cmd') ->
returnM (HsProc pat' cmd')
+
+tc_expr e@(HsArrApp _ _ _ _ _) _
+ = failWithTc (vcat [ptext SLIT("The arrow command"), nest 2 (ppr e),
+ ptext SLIT("was found where an expression was expected")])
+
+tc_expr e@(HsArrForm _ _ _) _
+ = failWithTc (vcat [ptext SLIT("The arrow command"), nest 2 (ppr e),
+ ptext SLIT("was found where an expression was expected")])
\end{code}
%************************************************************************
-- the type of dataConWrapId (see note on "stupid context" in DataCon.lhs
-- It's dual to TcPat.tcConstructor
inst_data_con data_con
- = tcInstDataCon orig data_con `thenM` \ (ty_args, ex_dicts, arg_tys, result_ty, _) ->
- extendLIEs ex_dicts `thenM_`
- getSrcSpanM `thenM` \ loc ->
+ = tcInstDataCon orig VanillaTv data_con `thenM` \ (ty_args, ex_dicts, arg_tys, result_ty, _) ->
+ extendLIEs ex_dicts `thenM_`
+ getSrcSpanM `thenM` \ loc ->
returnM (unLoc (mkHsDictApp (mkHsTyApp (L loc (HsVar (dataConWrapId data_con))) ty_args)
(map instToId ex_dicts)),
mkFunTys arg_tys result_ty)