Web/Comparison of Happstack, Snap and Yesod
Still fixing the formatting broken stuff from conversion to wiki from markdown. I will outline planned sections in headings momentarily.
There is no existing complete comparison of Happstack, Snap and Yesod. Such a thing helps people to choose and feel they've made a well-founded decision. I need this too, so I thought I'd write it.
The home page
I'll start with the web sites at first impression.
- Happstack's web site is simple and clean.
- Snap's web site is pretty and professionally designed.
- Yesod's web site is okay, good links.
Next, the main maintainers of the projects is handy to know:
- Happstack — There is no link on the homepage about maintainers, but I garnered Jeremy Shaw, aka stepcut. I can't tell if there are any more maintainers, the darcs history doesn't show any major contributors. A list of contributors, I suppose, can be seen on the patch-tag homepage, I'm not going to bother trying to convert usernames to real names.
- Snap — Many are listed as ‘contributors’ on the about page, but Gregory Collins and Doug Beardsley are certainly maintainers, the rest I'm not sure, may be just contributors; the site doesn't distinguish.
- Yesod — Michael Snoyman, Greg Weber, there are other contributors listed, some of which might be maintainers.
- Happstack — Garnered from the Community page, the HappS mailing list, #happs on Freenode IRC, with IRC logs, Google Code for issue tracking, a wiki, Twitter, a Facebook group.
- Snap — Garnered from the About page, the Snap mailing list #snapframework on Freenode IRC, Github for issue tracking.
- Yesod — Garnered from the Community Resources, StackOverflow, a Google Group, the web-devel mailing list, #yesod on Freenode IRC, Github for issue tracking, a wiki for posting documentation.
There is roughly the same set of documentation for each, varying in side and detail, with a quickstart for each, more complete tutorials, and haddock API documentation.
- Happstack — A small tutorial covering writing a simple program, a larger crash course cover routing, templating, request handling, static files and database state, and examples. And haddock docs.
- Snap — A simple quickstart guide, a slightly larger tutorial similar to happstack's, a tutorial on snaplets (Snap's means of extension), a tutorial on heist (Snap's templating) and haddock docs.
- Yesod — a simple quickstart guide similar to Snap's, screencasts, an online book similar to Happstack's crash course, covering templates, widgets, routing, forms, sessions, databases, deployment, authentication, scaffolding, internationalisation, and examples. And haddock docs.
It's interesting to know who is using these frameworks.
Not found any yet.
- hpaste is written with Snap but that's my own so it doesn't count.
In the beginning, I found Hamlet and Cassius to be quite strange. After some time I found it a lot easier to use. The Hamlet makes rapid design easier: less typing and no worrying about tag mismatches. It was also really good to only have to do something once with widgets!
It took me a bit longer to get to grips with haskell: when I get told that "customers is a [(CustomerId, Maybe Customer)]" it took me a while to work out what to do with it :) After I'd learned basics it became a lot easier and my work was a lot simpler.
Working at Massive started off quite scary: totally different development than what Im used to! After having worked on two projects using Yesod I will wish they are all this easy!
Hachicode is using Yesod, quoth “Nubis”, presumbly a developer:
- Braden Shepherdson made an AJAX chat application using Yesod.
- Björn Buckwalter made a URL shortener using Yesod.
Repositories and Installation
I am running Ubuntu 10.04.
$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.3 $ cabal --version cabal-install version 0.10.2 using version 22.214.171.124 of the Cabal library $ cabal-dev install happstack … Registering happstack-6.0.5... real 2m13.240s user 1m38.886s sys 0m7.588s
Installs fine in GHC 6.12.3 in a couple of minutes.
The web site Download page advises to install the snap package from Hackage:
$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.3 $ cabal --version cabal-install version 0.10.2 using version 126.96.36.199 of the Cabal library $ cabal-dev install snap … Registering snap-0.7... real 5m1.105s user 4m24.369s sys 0m15.389s
Installs fine in GHC 6.12.3 in a couple of minutes.
The web site advises to install the yesod package from Hackage.
$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.3 $ cabal --version cabal-install version 0.10.2 using version 188.8.131.52 of the Cabal library $ time cabal-dev install yesod Resolving dependencies... cabal: cannot configure conduit-0.0.1.1. It requires base >=4.3 && <5 For the dependency on base >=4.3 && <5 there are these packages: base-184.108.40.206, base-220.127.116.11, base-18.104.22.168 and base-22.214.171.124. However none of them are available.
This was anticipated in the documentation, so the behaviour is expected.
chris@cn-done:~/yesod$ export PATH=/opt/ghc/7.0.4/bin/:$PATH chris@cn-done:~/yesod$ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.0.4 chris@cn-done:~/yesod$ cabal install Cabal cabal-install --bindir=/opt/ghc/7.0.4/bin … Linking dist/build/cabal/cabal ... Installing executable(s) in /opt/ghc/7.0.4/bin chris@cn-done:~/yesod$ cabal --version cabal-install version 0.10.2 using version 126.96.36.199 of the Cabal library
So I'm now on 7.0.4 with the latest cabal installed for 7.0.4. Proceeding should work:
$ time cabal-dev install yesod … Registering yesod-0.9.4.1... real 8m55.781s user 7m2.446s sys 0m21.809s
Installs with no problems as the guide suggests.
- I've decided rather than just writing what I need, as I usually do, I would try to use a framework for my next project.
- Figured out from here, “Maintainer of Happstack, the Haskell web application framework: http://www.happstack.com/”
- Lemmih, Saizan, alexjacobson, creighton, mightybyte, stepcut, tphyahoo.
- Shu-yu Guo, James Sanders, Carl Howells, Shane O'Brien, Ozgun Ataman, Chris Smith, Jurriën Stutterheim.
- Garnered from the contributors page, via Community.
- Felipe Lessa, Patrick Brisbin, Luite Stegeman, Hiromi ISHII, Kazu Yamamoto. See the page for past contributors.
- Which, due to the large proportion of Yesod-related questions, has essentially become ‘yesod-devel’.
- “If you want to install yesod painlessly, get ghc >= 7.” from the install help wiki page.