use of -no-hs-main causes TH compiles to fail
If you compile a project with -no-hs-main, so that you can (for example) have a c based main that runs first, then you can't use template haskell, as during compilation, the template haskell code fails to link and run.
What appears to happen is that the .c file with the "real main" gets loaded (in order to have a main), but it fails to find the function it will call as it is (directly, or transitively) dependent on the very template haskell enabled .hs file being compiled.
The attached tar ball is a simple cabal based project that builds three executables:
- plain-main - plain HS main, using a TH value
- c-no-th-main - c based main, calling into a HS function, no TH
- c-main - c based main, calling into a HS function that uses TH
The c-main program will fail to build, while the other two work (demonstrating that the TH code is reasonable, and that the c main function is reasonable.)
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |