
#9768: reify returns only first instance of class -------------------------------------+------------------------------------- Reporter: qnikst | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | https://gist.github.com/qnikst/b93e7154e78bcc159be2| Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by goldfire): * owner: => goldfire Comment: If you change your `test.hs` to {{{ {-# LANGUAGE TemplateHaskell #-} import Test def "A" def "B" $(return []) main = $(test) }}} it works. The extra splice changes the order of processing of top-level blocks. GHC breaks a module into a sequence of mutually-recursive blocks, separated by top-level declaration splices. But, it seems that the processing of these blocks does not proceed in strict top-to-bottom order. This doesn't quite go against spec -- TH claims to process splices in a non-deterministic order -- but I think we can do better for top-level declaration splices. I'll take a look at this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9768#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler