Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Backpack doesn't work with TemplateHaskell #4755
System configuration: Xubuntu,
The contents of
Steps to reproduce:
Without the patch the project builds fine. (It also used to build fine with this use of TH before I started using Backpack).
Curiously, although I can reproduce when I follow your reproduction instructions, when I try to make a synthetic example involving just lens deriving Template Haskell (even one of the fields in the record I'm deriving from comes from a signature), things seem to work fine.
Based on the error message, in particular, the reference to symbol
BTW, it would be nice if the error message here was better. See http://ghc.haskell.org/trac/ghc/ticket/14212
P.S. If you are feeling up for it, a minimized test case would help a lot! Though I suspect that in the end, it will be a TH function attempting to call show on an abstract type...
Interesting hypothesis, but I don't think that's right.
Yes, it's quite tricky to reproduce. Since
Right, I know :( but I could barely find time to report it at all. What I can tell, though, is that the issue occurs only when the concrete implementation has its own data/function declarations. Here's an alternative implementation of
I minimized the test case.
Pretty intruiging. It only triggers on a "fresh" build: if you edit a file, rebuild, and then edit it back, the problem goes away.
@int-index I believe the problem is that when we compile the instantiated version of a package, we don't correctly link it with the library it was instantiated with; i.e., the library doesn't show up as an ldd dependency. However, the ghc-pkg entry does have the correct deps, so things mostly work OK... except for Template Haskell, which relies on accurate ldd information for performing linking.
The correct place to fix this is GHC but there might be a hotfix for Cabal which may be helpful.