The web problem, and solving it from Haskell
An initial look at the Snap Framework and its templating engine, Heist
This was first delivered as a talk at fp-syd, the Functional Programming Special Interest Group, Sydney, 20 Sep 12. There aren't speaker notes but to provide a bit of context about what we were talking about, the slides have been annotated with comments about some of the themes we discussed. Some versions of Firefox show a black screen for the first slide on initial load; press Right, PageDown, or Spacebar and it should work; Left or PageUp will take you back a slide.
Is functional programming a good place to do web applications? Hard to say. The trick is to know why the web problem is a mess, how different frameworks approach solving it, and realize the trade-offs you make when choosing one. Turning to Haskell, we'll look at Snap, one of several Haskell web frameworks available, and its templating engine, Heist. To illustrate some of the basics, we'll walk through a small but surprisingly comprehensive application built using Snap. From there we'll talk about the unexpected directions the architecture of the web is taking us these days, and speculate whether we actually need templating much, if all.
As for functional programming, really, we don't get there in this talk. But we've laid the groundwork, bridging from the corseness of a web request to glorious purity of functional code. Next time we can look at the importance of composition, how the Snap authors are realizing this with their notion Snaplets, and how you can leverage it to achieve reusability in your code.