commercialhaskell / commercialhaskell/stack
Use less permissive types in the config monoids
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
`ConfigMonoid` (and probably other config monoids too) contains a few fields that have more permissive types than necessary. This has the effect that bad inputs go undetected or result in errors that are reported out of context or only after the inputs have been passed to ghc.
A few of the problematic fields:
- `configMonoidWorkDir`
- `configMonoidOs`
- `configMonoidExtraIncludeDirs`
Example interaction:
```
$ stack --extra-lib-dirs --oops build
these-0.7: unregistering (local file changes: Control/Monad/Chronicle.hs Control/Monad/Chronicle/Class.hs Control/Monad/Trans/Chronicle.hs Data...)
these-0.7: configure
Configuring these-0.7...
Warning: 'extra-lib-dirs: --oops' directory does not exist.
...
```
Compare this to the error message for an argument that must be a `Path Abs Dir`:
```
$ stack --stack-root --oops path
option --stack-root: Failed to parse absolute path to directory: '--oops'
Usage: stack [--help] [--version] [--numeric-version] [--hpack-numeric-version]
...
```
Contributor guide
Assessment
This issue has not been assessed yet.