commercialhaskell / commercialhaskell/stack
`-ddump-dir` does not take effect when build fails
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary/comments (optional)
It can be useful to get detailed output from the typechecker when a program fails to typecheck. It's also sometimes useful to use stack's great `-ddump-dir` option to avoid spelunking through `.stack-work` to get the output. Unfortunately, the option doesn't kick in if typechecking fails.
### Steps to reproduce
#### 1
```sh
stack new ddump-repro simple-library
cd ddump-repro
```
#### 2
Add to `stack.yaml`:
```
build:
ddump-dir: dumps
```
#### 3
Add to `ddump-repro.cabal`'s library stanza:
```
ghc-options: -ddump-to-file
```
#### 4
Change `src/Lib.hs` by adding `{-# OPTIONS_GHC -ddump-tc-trace #-}` and altering the string `"someFunc"` in the definition of `someFunc` to `3`.
#### 5
`stack build`.
### Expected
A new directory `dumps/` with the typechecking and constraint-solving dumps (this happens if you revert the code change that causes the typechecking error)
### Actual
No such directory
### Stack version
```
$ stack --version
Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2
```
### Method of installation
* Official binary, downloaded from stackage.org or fpcomplete's package repository
Contributor guide
Assessment
This issue has not been assessed yet.