The standard technique for pre-processing Haskell source code using Haskell has stopped working in recent versions of Cabal. The technique is as follows:
The cabal file is structured like this:
Name: foo
...
Executable foo-meta
...
Library
...
Executable foo
...
Then you pass "-F -pgmF dist/build/foo/foo-meta" to GHC for the source file you want to pre-process, e.g., using an OPTIONS_GHC pragma.
The effect is that first cabal builds foo-meta, then uses it to build the library, then builds the final executable.
But now, Cabal refuses to build the artifacts in the order I specified in the Cabal file. It always tries to build the library first, before the foo-meta executable, and the build fails.
Note: We have only tried this so far inside a sandbox. However, we have verified that the problem is definitely that cabal is not even trying to build foo-meta, not a problem with differences in the path to the foo-meta executable in a sandbox.
The standard technique for pre-processing Haskell source code using Haskell has stopped working in recent versions of Cabal. The technique is as follows:
The cabal file is structured like this:
Then you pass "
-F -pgmF dist/build/foo/foo-meta" to GHC for the source file you want to pre-process, e.g., using anOPTIONS_GHCpragma.The effect is that first cabal builds
foo-meta, then uses it to build the library, then builds the final executable.But now, Cabal refuses to build the artifacts in the order I specified in the Cabal file. It always tries to build the library first, before the
foo-metaexecutable, and the build fails.Note: We have only tried this so far inside a sandbox. However, we have verified that the problem is definitely that cabal is not even trying to build
foo-meta, not a problem with differences in the path to thefoo-metaexecutable in a sandbox.