-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cabal
's code-generators
to reimplement singletons-base
test suite without custom Setup.hs
#532
Comments
In light of the CI issues observed in #620 related to I have a very rough implementation of this in the
|
@RyanGlScott be aware that it's likely that As far as I know no package on Hackage uses |
Interestingly, the
Fun! |
This replaces `singletons-base`'s custom `Setup.hs` script with a `cabal` code generator. This finally allows `singletons-base` to have a `Simple` build type, but at the (relatively less extreme) cost of requiring `Cabal-3.8` or later in order to build. Remarkably, everything that the custom `Setup.hs` script did can be done in a much simpler way with a `cabal` code generator, as all of the information that the `singletons-base` test suite needs to invoke GHC can be inferred from the arguments passed to a code generator. One downside is that due to haskell/cabal#8421, the code generator must be implemented in a standalone executable package (`singletons-base-code-generator`). Until that `cabal` issue is fixed, we will need to upload `singletons-base-code-generator` to Hackage with each `singletons` release. Fixes #532.
This replaces `singletons-base`'s custom `Setup.hs` script with a `cabal` code generator. This finally allows `singletons-base` to have a `Simple` build type, but at the (relatively less extreme) cost of requiring `Cabal-3.8` or later in order to build. Remarkably, everything that the custom `Setup.hs` script did can be done in a much simpler way with a `cabal` code generator, as all of the information that the `singletons-base` test suite needs to invoke GHC can be inferred from the arguments passed to a code generator. One downside is that due to haskell/cabal#8421, the code generator must be implemented in a standalone executable package (`singletons-base-code-generator`). Until that `cabal` issue is fixed, we will need to upload `singletons-base-code-generator` to Hackage with each `singletons` release. Fixes #532.
Cabal-3.8
debuts a newcode-generators
feature that can be used to generate modules when preprocessing a test suite and include them as part of building the test suite. One of the intended use cases for a code generator is to fill the role that is often served today by customSetup.hs
scripts. In particular,singletons-base
's customSetup.hs
script seems like a prime candidate for being implemented as a code generator, since the primary reason for using a customSetup.hs
script is to learn what-package-id
arguments to pass to GHC to get the dependencies right. That is exactly the sort of information that code generators have access to.The text was updated successfully, but these errors were encountered: