Skip to content
  • Simon Peyton Jones's avatar
    In GHCi, bind identifiers at TH level 'impLevel' · 800dba35
    Simon Peyton Jones authored
    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.
    800dba35