Fix building of executables that use TH with dyn-by-default GHC. 

Fixes #1252. Makes the test suite pass with GHC HEAD.