Tuesday, April 17, 2012

A Haskell Newbies' guide to Snap, Part 1 (updated for Snap 0.8)

[This tutorial is now updated for Snap 0.8. It could really use a more thorough overhaul -- the code does a poor job of separating view from model. But I think it still has value in demonstrating the API]  

I've spent a bit of time working up a simple application in the Snap web framework.  This proved to be a bit of a challenge: the documentation for Snap is definitely a work in progress, and doesn't cater well to a Haskell newbie such as myself.  This account is intended to help others in my position get up to speed on Snap, by filling in some of the information that the tutorial's authors may have taken for granted.  It is not intended as a standalone introduction to Snap. If you want to use this document to help you learn Snap, I would suggest the following steps:
  • Read the first four Snap/Heist documents in the TUTORIAL section
  • Read through this document
  • Build an example application