1

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.

1 Answer 1

2

Stack provides a --exec flag which allows you to do this. Check the 'Flags' documentation for a full example, but we can see a command like:

$ stack build --test --exec "echo Hi!"

Where --exec is the 'do other stuff' and --test runs the tests.

Related to your example, it could look like:

stack build \
  --exec "hlint foo" \
  --exec "~/.cabal/bin/scan -j False bar"
  --exec "~/.cabal/bin/doctest baz"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.