1. new in this version
  2. build a web 2.0 app in happstack
  3. why happstack is cool
  4. getting started with happstack
  5. prerequisites
  6. cabal install me
  7. first shot at happstack
  8. url handling
  9. basic HTML inclusion
  10. templates
  11. stringtemplate basics
  12. debugging
  13. form data: get and post
  14. form data: file uploads
  15. cookies
  16. introduction to macid
  17. first steps with macid
  18. scaling with multimaster
  19. using macid safely
  20. macid dummy data
  21. changing the data model
  22. macid stress test
  23. limitations of macid
  24. foreign characters
  25. IxSets
  26. cron jobs
  27. thanks
  28. appendix (floundering in ghci)

Run This Tutorial Locally

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.