Before going further, you may want to inform yourself about the basic prerequisites, both knowledge and equipment, you need to make the best use of this tutorial.
To fetch the latest version of this tutorial, install darcs, fetch the repo, and run happs-tutorial from within the repo:
darcs get http://patch-tag.com/r/wchogg/happstack-tutorial/pullrepo happstack-tutorial cd happstack-tutorial cabal install happs-tutorial 5001 True True
You should now be able to browse this tutorial offline by running the executable, and opening http://localhost:5001 in your browser.
If you've never used cabal install or need more detailed info see the cabal install homepage.
If you prefer to run the app in ghci, do ./hackInGhci.sh and then execute runInGhci inside Main.hs.
Every so often, when starting via runInGhci, you may get an error message like:
*Main> runInGhci happs tutorial running in ghci. exit :q ghci completely and reenter ghci, before restarting. *** Exception: _local/happs-tutorial_state/events-0000000006: openFile: resource busy (file is locked)
Don't worry about it. Every time I get this error I simply run runInGhci again, and the second time it always works.
This issue does not occur when you run the tutorial from a compiled executable, which is of course how you should be running for a production application.
If you get the error "`Control.Monad.Trans' was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2", you can use the command "ghc-pkg hide transformers" to prevent ghci from seeing the conflicting package.
You may also want to start Happstack on boot.
Next up is a first example of using Happstack.