X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcSplice.lhs;h=e23155d0de4ff22c6641cfed9c3a0a44a8f67170;hb=cd2c71bb9bfe5dd3582263468712c29192c7340e;hp=3302b237378590cdc6dbc6e145081418bac3e006;hpb=f4510d27c5883fe7e8570f4dd49d45a8b0122f2c;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index 3302b23..e23155d 100644 --- a/compiler/typecheck/TcSplice.lhs +++ b/compiler/typecheck/TcSplice.lhs @@ -52,6 +52,7 @@ import ErrUtils import SrcLoc import Outputable import Unique +import DynFlags import PackageConfig import BasicTypes import Panic @@ -90,6 +91,18 @@ tcSpliceDecls e = pprPanic "Cant do tcSpliceDecls without GHCi" (ppr e) %* * %************************************************************************ +Note [Handling brackets] +~~~~~~~~~~~~~~~~~~~~~~~~ +Source: f = [| Just $(g 3) |] + The [| |] part is a HsBracket + +Typechecked: f = [| Just ${s7}(g 3) |]{s7 = g Int 3} + The [| |] part is a HsBracketOut, containing *renamed* (not typechecked) expression + The "s7" is the "splice point"; the (g Int 3) part is a typechecked expression + +Desugared: f = do { s7 <- g Int 3 + ; return (ConE "Data.Maybe.Just" s7) } + \begin{code} tcBracket :: HsBracket Name -> BoxyRhoType -> TcM (LHsExpr TcId) tcBracket brack res_ty @@ -363,8 +376,11 @@ runMeta :: (SrcSpan -> th_syn -> Either Message hs_syn) -> TcM hs_syn -- Of type t runMeta convert expr = do { -- Desugar +#if defined(GHCI) && defined(DEBUGGER) + ds_expr <- unsetOptM Opt_Debugging $ initDsTc (dsLExpr expr) +#else ds_expr <- initDsTc (dsLExpr expr) - +#endif -- Compile and link it; might fail if linking fails ; hsc_env <- getTopEnv ; src_span <- getSrcSpanM