-
-tcMonoExpr (HsSplice n expr loc) res_ty = addSrcLoc loc (tcSpliceExpr n expr res_ty)
-
-tcMonoExpr (HsBracket brack loc) res_ty
- = addSrcLoc loc $
- getStage `thenM` \ level ->
- case bracketOK level of {
- Nothing -> failWithTc (illegalBracket level) ;
- Just next_level ->
-
- -- Typecheck expr to make sure it is valid,
- -- but throw away the results. We'll type check
- -- it again when we actually use it.
- newMutVar [] `thenM` \ pending_splices ->
- getLIEVar `thenM` \ lie_var ->
-
- setStage (Brack next_level pending_splices lie_var) (
- getLIE (tcBracket brack)
- ) `thenM` \ (meta_ty, lie) ->
- tcSimplifyBracket lie `thenM_`
-
- unifyTauTy res_ty meta_ty `thenM_`
-
- -- Return the original expression, not the type-decorated one
- readMutVar pending_splices `thenM` \ pendings ->
- returnM (HsBracketOut brack pendings)
- }
-
-tcMonoExpr (HsReify (Reify flavour name)) res_ty
- = addErrCtxt (ptext SLIT("At the reification of") <+> ppr name) $
- tcMetaTy tycon_name `thenM` \ reify_ty ->
- unifyTauTy res_ty reify_ty `thenM_`
- returnM (HsReify (ReifyOut flavour name))
- where
- tycon_name = case flavour of
- ReifyDecl -> DsMeta.decTyConName
- ReifyType -> DsMeta.typTyConName
- ReifyFixity -> pprPanic "tcMonoExpr: cant do reifyFixity yet" (ppr name)
-#endif GHCI
-\end{code}
-
-%************************************************************************
-%* *
-\subsection{Implicit Parameter bindings}
-%* *
-%************************************************************************
-
-\begin{code}
-tcMonoExpr (HsWith expr binds is_with) res_ty
- = getLIE (tcMonoExpr expr res_ty) `thenM` \ (expr', expr_lie) ->
- mapAndUnzipM tc_ip_bind binds `thenM` \ (avail_ips, binds') ->
-
- -- If the binding binds ?x = E, we must now
- -- discharge any ?x constraints in expr_lie
- tcSimplifyIPs avail_ips expr_lie `thenM` \ dict_binds ->
- let
- expr'' = HsLet (mkMonoBind dict_binds [] Recursive) expr'
- in
- returnM (HsWith expr'' binds' is_with)
- where
- tc_ip_bind (ip, expr)
- = newTyVarTy openTypeKind `thenM` \ ty ->
- getSrcLocM `thenM` \ loc ->
- newIPDict (IPBind ip) ip ty `thenM` \ (ip', ip_inst) ->
- tcMonoExpr expr ty `thenM` \ expr' ->
- returnM (ip_inst, (ip', expr'))