I had made a script for compiling my haskell programs (so far just simple scripts consisting in a single source file) that contained, before the call to ghc, the following lines:
echo "Running hlint"
hlint ${1}
echo "Running scan"
~/.cabal/bin/scan -j False ${1}
echo "Running doctest"
~/.cabal/bin/doctest ${1}
(${1} referring to the single .hs source file.)
How to get some equivalent checking done when using stack to manage and build my programs?
I would like to setup some global configuration that would have these commands run automatically on the source code when calling stack build in any of my projects.
Stack provides a
--execflag which allows you to do this. Check the 'Flags' documentation for a full example, but we can see a command like:Where
--execis the 'do other stuff' and--testruns the tests.Related to your example, it could look like: