Prerequisites: GHC + cabal-install
Setup project skeleton using hi and my template:
% cabal update
% cabal install hi
% hi \
--module-name "Foo.Bar" \
--package-name "foo" \
--author 'Your Name' \
--email 'your@email.com' \
--repository gh:pbrisbin/hi-hspec
Create a sandbox and install dependencies:
% cd foo
% cabal sandbox init
% cabal install --enable-tests --dependencies-only -j4
Setup and work with your first spec:
% vim test/Foo/BarSpec.hs
% cabal exec ghci test/Foo/BarSpec.hs # compile single spec
# run :reload to re-compile
# run :main to execute test
Directly run a single (spec) file, useful as an editor hot-key:
% echo ':main' | cabal exec ghci -v0 test/Foo/BarSpec.hs
Implement:
% vim src/Foo/Bar.hs
Run all tests:
% cabal test
Modify package information (description, dependencies, version), etc:
% vim foo.cabal
Build a source distribution file (tarball):
% cabal sdist
Upload it to Hackage (requires account):
% cabal upload dist/foo-0.0.1.tar.gz
Install it from somewhere else
% cabal update
% cabal install foo
Done!