stack exec -- haddock test/**/*.hs -odocs -h
I tested with stack 1.7.1 and haddock 2.20.0.
It's not clear what platform you are on; that will work on zsh on linux. The principle should work on other platforms. It runs haddock on all the .hs
files in the test
directory and puts the html output (-h
) in the docs
directory (which it creates, if necessary). It seems to overwrite whatever is in there.
You may wish to raise a feature request on the stack issue tracker, too. It's a good suggestion! And the resulting command would include the correct dependency links, without you having to supply them yourself.
Finally, Cabal, with its new-build
options, can apparently do this (I haven't tested it). The haddock-tests: True
option would go in the cabal.project
file.