
#12993: GHC 8.0.2-rc2 template Haskell interface file issue -------------------------------------+------------------------------------- Reporter: glguy | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.2-rc2 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): The motivation behind that commit is that if a record selector is not exported and not used within the module, code for it was still generated. With that commit they're removed. I agree that this bug is caused by that change. I think a proper fix would be to detect that in these cases the selector is actually used. This is already done for toplevel definitions. For example: {{{#!haskell module Lib (x) where x, y :: Int x = 1 y = 2 }}} Compile and run `nm` on the object file, and you'll see that there isn't a symbol `Lib_y_closure`. If you export `y` you'll see that symbol. If I export `y` in a TH code it still works fine: {{{#!haskell module Lib (x, z) where x, y :: Int x = 1 y = 2 z = [|y|] }}} If you run `nm` you'll see that there's a `Lib_y_closure`. Apparently this last part is not done for record selectors and we should fix that. @bgamari, if this is urgent feel free to revert that commit, I can put it back once I figure out how to fix this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12993#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler