In GHCi, bind identifiers at TH level 'impLevel'
authorsimonpj@microsoft.com <unknown>
Wed, 23 May 2007 11:42:53 +0000 (11:42 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 23 May 2007 11:42:53 +0000 (11:42 +0000)
commit800dba35d6ad4dde3d54a293687307f160a05dea
tree2d926710de8297d87ca077683b6564779aaa56a7
parent87b3c589498941332029a8a9da35e94a6139f0eb
In GHCi, bind identifiers at TH level 'impLevel'

Consder Trac #1265, which does this in GHCi:

Prelude> let doit = fail "Code not written yet" :: ExpQ
Prelude> $(doit)

Even though 'doit' is defined "in the same module", it's OK to use it in a splice
because it'll have been fully compiled to bytecode.  (Contrast the situation if
these two lines appeared in a single, compiled module.)

Hence we want to bind 'doit' at TH's "imported level" (TcRnTypes.impLevel).
This used to happen because GHCi-bound Ids were in the *global* type
env (and hence at "imported level").  But since SimonM moved
GHCi-bound ids to the *local* type env (for good reasons) the above
program has been rejected.

This patch makes it work again.
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcRnDriver.lhs