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
Haskell source pre-processing in Haskell no longer works #1541
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 "
The effect is that first cabal builds
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
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
That's really ugly, for a few reasons.
This being Haskell, I agree that it would be nice to move away from the imperative feel of requiring the artifacts to built in the order they physically appear in the cabal file. Perhaps we should add some cabal file syntax for expressing a dependency of one artifact on another defined in the same cabal file. In one direction we already have something primitive: an executable can list its own package name as a build dependency, causing the library to be built before this executable.
But in the meantime, cabal has broken behavior that was previously working.
I may have found a bug which is related to why cabal seems to be ignoring the build order.
in: Cabal/Distribution/Simple/LocalBuildInfo.hs, lines 342 - 357:
Based on the comments of the withAllComponentsInBuildOrder function, it is looking for a field compBuildOrder of the LocalBuildInfo type, which seems to be defined on lines 116-160. However, I don't see a compBuildOrder field in that definition.
Sorry if I missed something; I'm still relatively new to Haskell.
referenced this issue
Nov 29, 2013
@ygale we already have a system for this, which is the build-tool field. You can use that to list that your lib or exe depends on the build tool defined within the same package.
Now having said that, while I wrote that code I've never actually tested it (or if I did, I don't remember!) So could you give that a go and tell us if it works, and we can close this ticket, or re-purpose it.
And about having broken existing things, we never promised the components would be built in order, and using
This is a little known feature of Cabal, not mentioned in the manual, and rarely known by many who have this problem in the wild.
Additionally, it would be quite nice if we could support the preprocessor use-case without needing people to add a custom Setup.hs. Perhaps we can support