
#12778: Expose variables bound in quotations to reify -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: template- | haskell reify Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by facundo.dominguez): Another issue with this approach is that the finalizer would not be registered by `addModFinalizer` but it is carried in the AST instead. If the user discards the result of the inner splice, the finalizer wouldn't run. The following expression does not run the finalizer, because exp carries the finalizers and it is not used in the result of the outermost splice. {{{ $(do exp@(SplicedE here_we_carry_the_finalizers (TupE [])) <- [| $(addModFinalizer (runIO (putStrLn "finalizer")) >> [| () |] ) |] [| () |] ) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12778#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler