-tcMonoExpr e0@(HsCCall lbl args may_gc is_casm ignored_fake_result_ty) res_ty
-
- = getDOptsTc `thenNF_Tc` \ dflags ->
-
- checkTc (not (is_casm && dopt_HscLang dflags /= HscC))
- (vcat [text "_casm_ is only supported when compiling via C (-fvia-C).",
- text "Either compile with -fvia-C, or, better, rewrite your code",
- text "to use the foreign function interface. _casm_s are deprecated",
- text "and support for them may one day disappear."])
- `thenTc_`
-
- -- Get the callable and returnable classes.
- tcLookupClass cCallableClassName `thenNF_Tc` \ cCallableClass ->
- tcLookupClass cReturnableClassName `thenNF_Tc` \ cReturnableClass ->
- tcLookupTyCon ioTyConName `thenNF_Tc` \ ioTyCon ->
- let
- new_arg_dict (arg, arg_ty)
- = newDicts (CCallOrigin (unpackFS lbl) (Just arg))
- [mkClassPred cCallableClass [arg_ty]] `thenNF_Tc` \ arg_dicts ->
- returnNF_Tc arg_dicts -- Actually a singleton bag
-
- result_origin = CCallOrigin (unpackFS lbl) Nothing {- Not an arg -}
- in
-
- -- Arguments
- let tv_idxs | null args = []
- | otherwise = [1..length args]
- in
- newTyVarTys (length tv_idxs) openTypeKind `thenNF_Tc` \ arg_tys ->
- tcMonoExprs args arg_tys `thenTc` \ (args', args_lie) ->
-
- -- The argument types can be unlifted or lifted; the result
- -- type must, however, be lifted since it's an argument to the IO
- -- type constructor.
- newTyVarTy liftedTypeKind `thenNF_Tc` \ result_ty ->
- let
- io_result_ty = mkTyConApp ioTyCon [result_ty]
- in
- unifyTauTy res_ty io_result_ty `thenTc_`
-
- -- Construct the extra insts, which encode the
- -- constraints on the argument and result types.
- mapNF_Tc new_arg_dict (zipEqual "tcMonoExpr:CCall" args arg_tys) `thenNF_Tc` \ ccarg_dicts_s ->
- newDicts result_origin [mkClassPred cReturnableClass [result_ty]] `thenNF_Tc` \ ccres_dict ->
- returnTc (HsCCall lbl args' may_gc is_casm io_result_ty,
- mkLIE (ccres_dict ++ concat ccarg_dicts_s) `plusLIE` args_lie)
-\end{code}
-
-\begin{code}
-tcMonoExpr (HsSCC lbl expr) res_ty
- = tcMonoExpr expr res_ty `thenTc` \ (expr', lie) ->
- returnTc (HsSCC lbl expr', lie)
-
-tcMonoExpr (HsLet binds expr) res_ty