[GHC] #12818: Allow reify to find top-level bindings in later declaration groups

#12818: Allow reify to find top-level bindings in later declaration groups -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): Phab:D2519 | Wiki Page: -------------------------------------+------------------------------------- Some time ago, at Tweag we were considering inspecting the types of declarations added with `addTopDecls` like this: {{{ {-# LANGUAGE TemplateHaskell #-} import Language.Haskell.TH.Syntax main :: IO () main = $(do ds <- [d| f = True |] addTopDecls ds addModFinalizer $ do VarI _ t _ <- reify (mkName "f") runIO $ hPutStrLn stderr ("f :: " ++ show t) [| return () |] ) }}} `f` is not in scope when the finalizer is added. But its type would be known when the finalizer runs. This worked before the patch https://phabricator.haskell.org/D2286. There is a patch that we submitted to address this https://phabricator.haskell.org/D2519, but it turned out later that we didn't need it and the patch was considered less than ideal. We are opening this ticket to keep track of the nuance in case someone finds the patch useful later. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12818 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12818: Allow reify to find top-level bindings in later declaration groups -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11832 | Differential Rev(s): Phab:D2519 Wiki Page: | -------------------------------------+------------------------------------- Changes (by facundo.dominguez): * related: => #11832 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12818#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC