pretty-simple icon indicating copy to clipboard operation
pretty-simple copied to clipboard

Move away from build-type Custom

Open andreabedini opened this issue 1 year ago • 2 comments

cabal-doctest is no longer unsupported or needed.

The author of the doctest package recommends^1 to run doctests with

cabal repl --with-ghc=doctest

This change removes the custom-setup and adjusts the test-suite to use the recommended approach above. The package doctest is added to the project with extra-packages to make sure its dependencies are always in scope (a small variation to the approach suggested by the doctest author).

andreabedini avatar Nov 08 '23 04:11 andreabedini

Could you change this so that the doctests will be run when you do cabal test?

Unfortunately the short answer is no. This is exactly how doctest recommends to be run https://github.com/sol/doctest#running-doctest-for-a-cabal-package.

cabal has a new feature that would allow running doctest with cabal test but that would require coordination with doctest I am afraid. So I thought I'd stick with the recommended way.

andreabedini avatar Nov 08 '23 08:11 andreabedini

@andreabedini My two requirements here would be:

  • There's an easy way to run the doctests, ideally as a test target in the .cabal file, so that cabal test would also run the doctests.
  • All the common Haskell build tools can (easily) run the doctests. I have the following in mind:
    • cabal-install
    • stack
    • the Nixpkgs Haskell infrastructure (which is based on Setup.hs / Cabal)
    • haskell.nix (although I know haskell.nix has had trouble with cabal-doctest in the past, so maybe don't need to include this one)

cabal-doctest currently meets these requirements, but has the following drawbacks:

  • It uses Custom
  • Its deprecated ??
  • It often feels somewhat hacky

It would be great if there was a doctest solution that meets all of my above requirements, and doesn't have any of these drawbacks.

cdepillabout avatar Nov 08 '23 13:11 cdepillabout

The new SetupHooks API will provide a better solution.

andreabedini avatar Jun 27 '24 04:06 andreabedini