haskell / haskell/cabal

Cabal doesn't actually use cpphs for .cpphs files

Open
#4,278 4 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome Cabal: cmd/build type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

According to the [Cabal User guide](https://www.haskell.org/cabal/users-guide/developing-packages.html#modules-and-preprocessors), `.cpphs` files are preprocessed using the `cpphs` tool.

But this doesn't seem to be the case. Create any trivial Cabal package, including at least one file with a .pphs extension. Notice the verbose output:

```
$ stack new foo simple-library
$ cd foo
$ mv src/Lib.hs src/Lib.cpphs
$ cabal build --verbose
[...]
Preprocessing library foo-0.1.0.0...
creating dist/build
/home/mboes/.nix-profile/bin/ghc -E -cpp -x hs -optP-include -optPdist/build/autogen/cabal_macros.h -o dist/build/Lib.hs src/Lib.cpphs '-D__GLASGOW_HASKELL__=800' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1'
Building library...
creating dist/build
[...]
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the report by creating a trivial Cabal package, renaming src/Lib.hs to src/Lib.cpphs, and running cabal build --verbose. Compare the documented .cpphs behavior in the Cabal User Guide with the displayed GHC command; done means the implementation and documentation agree about which preprocessor handles .cpphs files.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.