Difference between revisions of "Web/Comparison of Happstack, Snap and Yesod"

From HaskellWiki
< Web
Jump to navigation Jump to search
(→‎Features: server type)
 
(18 intermediate revisions by 4 users not shown)
Line 7: Line 7:
 
I'll start with the web sites at first impression.
 
I'll start with the web sites at first impression.
   
* [http://happstack.com/index.html Happstack's web site] is simple and clean.
+
* [http://happstack.com/ Happstack's web site] is simple and clean.
 
* [http://snapframework.com/ Snap's web site] is pretty and professionally designed.
 
* [http://snapframework.com/ Snap's web site] is pretty and professionally designed.
 
* [http://www.yesodweb.com/ Yesod's web site] is okay, good links.
 
* [http://www.yesodweb.com/ Yesod's web site] is okay, good links.
Line 15: Line 15:
 
Next, the main maintainers of the projects is handy to know:
 
Next, the main maintainers of the projects is handy to know:
   
* Happstack — Happstack is currently maintained by [http://www.n-heptane.com/ Jeremy Shaw (aka stepcut)] with financial support from [http://seereason.com seereason.com]. Significant past (and present) contributors and maintainers include Alex Jacobson, Lemmih, Matthew Elder, Andrea Vezzosi (Saizan), Thomas Hartman, Gracjan Polak, Antoine Latter, Joachim Fasting, Facundo Domínguez, Creighton Hogg, Einar Karttunen, Shae Erisson (shapr), Ian Lynagh, and others.
+
* Happstack — Happstack is currently maintained by [http://www.n-heptane.com/ Jeremy Shaw (aka stepcut)] with financial support from [http://seereason.com seereason.com]. Significant past (and present) contributors and maintainers include Alex Jacobson, Lemmih, Matthew Elder, Andrea Vezzosi (Saizan), Thomas Hartman, Gracjan Polak, Antoine Latter, Joachim Fasting, Facundo Domínguez, Caylee Hogg, Einar Karttunen, Shae Erisson (shapr), Ian Lynagh, and others.
 
* Snap — Many are listed as ‘contributors’ on [http://snapframework.com/about the about page], but [http://gregorycollins.net/ Gregory Collins] and [http://softwaresimply.blogspot.com/ Doug Beardsley] are certainly maintainers, the rest I'm not sure, may be just contributors; ([http://rfrn.org/~shu Shu-yu Guo], [http://james-sanders.com/ James Sanders], Carl Howells, Shane O'Brien, [http://github.com/ozataman Ozgun Ataman], [http://github.com/cdsmith Chris Smith], [https://github.com/norm2782 Jurriën Stutterheim].) the site doesn't distinguish.
 
* Snap — Many are listed as ‘contributors’ on [http://snapframework.com/about the about page], but [http://gregorycollins.net/ Gregory Collins] and [http://softwaresimply.blogspot.com/ Doug Beardsley] are certainly maintainers, the rest I'm not sure, may be just contributors; ([http://rfrn.org/~shu Shu-yu Guo], [http://james-sanders.com/ James Sanders], Carl Howells, Shane O'Brien, [http://github.com/ozataman Ozgun Ataman], [http://github.com/cdsmith Chris Smith], [https://github.com/norm2782 Jurriën Stutterheim].) the site doesn't distinguish.
 
* Yesod — [http://www.snoyman.com/ Michael Snoyman], [http://blog.gregweber.info/ Greg Weber], (Garnered from [http://www.yesodweb.com/page/contributors the contributors page], via Community.) there are other contributors listed, some of which might be maintainers. (Felipe Lessa, [http://pbrisbin.com/ Patrick Brisbin], [https://github.com/luite Luite Stegeman], [http://konn.x0.com/ Hiromi ISHII], [http://www.mew.org/~kazu/ Kazu Yamamoto]. See the page for past contributors.)
 
* Yesod — [http://www.snoyman.com/ Michael Snoyman], [http://blog.gregweber.info/ Greg Weber], (Garnered from [http://www.yesodweb.com/page/contributors the contributors page], via Community.) there are other contributors listed, some of which might be maintainers. (Felipe Lessa, [http://pbrisbin.com/ Patrick Brisbin], [https://github.com/luite Luite Stegeman], [http://konn.x0.com/ Hiromi ISHII], [http://www.mew.org/~kazu/ Kazu Yamamoto]. See the page for past contributors.)
Line 31: Line 31:
 
* Happstack — [http://happstack.com/docs/happstack-lite/happstack-lite.html A small tutorial] covering writing a simple program, a larger [http://happstack.com/docs/crashcourse/index.html crash course] cover routing, templating, request handling, static files and database state, and examples. And [http://happstack.com/docs/6.0.0/index.html haddock docs.]
 
* Happstack — [http://happstack.com/docs/happstack-lite/happstack-lite.html A small tutorial] covering writing a simple program, a larger [http://happstack.com/docs/crashcourse/index.html crash course] cover routing, templating, request handling, static files and database state, and examples. And [http://happstack.com/docs/6.0.0/index.html haddock docs.]
 
* Snap — [http://snapframework.com/docs/quickstart A simple quickstart guide], a [http://snapframework.com/docs/tutorials/snap-api slightly larger tutorial similar to happstack's], a [http://snapframework.com/docs/tutorials/snaplets-tutorial tutorial on snaplets (Snap's means of extension)], a tutorial on [http://snapframework.com/docs/tutorials/heist/ heist (Snap's templating)] and [http://hackage.haskell.org/packages/archive/snap/0.7/doc/html/Snap.html haddock docs].
 
* Snap — [http://snapframework.com/docs/quickstart A simple quickstart guide], a [http://snapframework.com/docs/tutorials/snap-api slightly larger tutorial similar to happstack's], a [http://snapframework.com/docs/tutorials/snaplets-tutorial tutorial on snaplets (Snap's means of extension)], a tutorial on [http://snapframework.com/docs/tutorials/heist/ heist (Snap's templating)] and [http://hackage.haskell.org/packages/archive/snap/0.7/doc/html/Snap.html haddock docs].
* Yesod — a [http://www.yesodweb.com/page/five-minutes simple quickstart guide similar to Snap's], [http://www.yesodweb.com/page/screencasts screencasts], an online [http://www.yesodweb.com/book book] similar to Happstack's crash course, covering templates, widgets, routing, forms, sessions, databases, deployment, authentication, scaffolding, internationalisation, and examples. And [http://www.yesodweb.com/wiki/API%20Documentation haddock docs].
+
* Yesod — a [http://www.yesodweb.com/page/five-minutes simple quickstart guide] similar to Snap's, [http://www.yesodweb.com/page/screencasts screencasts], an online [http://www.yesodweb.com/book book] similar to Happstack's crash course, covering templates, widgets, routing, forms, sessions, databases, deployment, authentication, scaffolding, internationalisation, and examples. And [http://www.yesodweb.com/wiki/API%20Documentation haddock docs].
   
 
== Use Cases ==
 
== Use Cases ==
Line 83: Line 83:
 
* [http://meadowstalk.com/post/new-blog Personal site of Blake Rain]
 
* [http://meadowstalk.com/post/new-blog Personal site of Blake Rain]
 
* [https://www.pascal-wittmann.de/ Personal site of Pascal Wittmann]
 
* [https://www.pascal-wittmann.de/ Personal site of Pascal Wittmann]
  +
* [https://www.mochilerosecuador.com/ MochilerosEcuador] - A Tourism site for backpacking in Ecuador
   
 
== Repositories and Installation ==
 
== Repositories and Installation ==
Line 166: Line 167:
   
 
== Features ==
 
== Features ==
  +
  +
This is an overview of features ''as supported directly by code in published packages''. When a feature is listed as "no special support" for a framework, it usually means you could somewhat trivially add the support yourself by integrating existing packages into the framework.
   
 
{| class="wikitable"
 
{| class="wikitable"
Line 180: Line 183:
 
| enumerator
 
| enumerator
 
| conduit
 
| conduit
 
|-
  +
! Code Reloading
  +
| plugins
 
| hint
  +
| yes
 
|-
 
! Scaffolding
  +
| not maintained
  +
| three templates
  +
| one template, interactive options
  +
|-
  +
! Extensibility
  +
| monad transformers
  +
| snaplets
  +
| subsites
  +
|-
  +
! Configuration
  +
| records
  +
| configurator
  +
| type classes, yaml
 
|-
 
|-
 
! Routing Combinators
 
! Routing Combinators
 
| [http://www.happstack.com/docs/crashcourse/RouteFilters.html#route_filters yes]
 
| [http://www.happstack.com/docs/crashcourse/RouteFilters.html#route_filters yes]
 
| yes
 
| yes
  +
| yes, with yesod-pure
| ?
 
 
|-
 
|-
 
! Type-safe Routing
 
! Type-safe Routing
Line 202: Line 225:
 
|-
 
|-
 
! JavaScript
 
! JavaScript
| jmacro
+
| jmacro, fay
 
| fay
 
| fay
| julius
+
| julius, fay
 
|-
 
|-
 
! Form Processing
 
! Form Processing
Line 210: Line 233:
 
| digestive-functors
 
| digestive-functors
 
| yesod-form
 
| yesod-form
  +
|-
 
! Client Sessions
  +
| <hask>SafeCopy a => a</hask>
  +
| <hask>HashMap Text Text</hask>
  +
| <hask>Map Text ByteString</hask>
 
|-
 
|-
 
! Authentication
 
! Authentication
Line 216: Line 244:
 
|-
 
|-
 
! External Databases
 
! External Databases
  +
| no special support (unless you count acid-state's "remote" backend)
  +
| several snaplets
  +
| persistent
 
|-
 
|-
 
! Internal Databases
 
! Internal Databases
  +
| acid-state (via documentation and happstack-foundation)
|-
 
  +
| snaplet-acid-state, snaplet-sqlite-simple
! Sessions
 
  +
| persistent-sqlite
|-
 
! Scaffolding
 
 
|}
 
|}

Latest revision as of 02:23, 6 March 2017

Note: Work in progress. 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.

The home page

I'll start with the web sites at first impression.

Maintainers

Next, the main maintainers of the projects is handy to know:

Communities

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.

Use Cases

It's interesting to know who is using these frameworks.

Happstack

Snap

  • hpaste ­— the Haskell pastebin.
  • Darcs Den — a place to share your darcs projects and collaborate with others.
  • housetab.org — a webapp for sharing expenses (source code here)
  • JCU — a web-based Prolog environment.
  • snap-pastie another pastebin.
  • snapframework.com the Snap home page.
  • Silk — a new way to create and consume content.
  • Karamaan Group — uses Snap for an internal company intranet.

Yesod

Repositories and Installation

I am running Ubuntu 10.04.

Happstack

Installed from the happstack package from Hackage, or can be retrieved via the hub.darcs.net repository. Info from the Download page.

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3
$ cabal --version
cabal-install version 0.10.2
using version 1.10.2.0 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.

Snap

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 1.10.2.0 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.

Yesod

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 1.10.2.0 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-4.3.0.0, base-4.3.1.0, base-4.4.0.0 and
base-4.4.1.0. However none of them are available.

This was anticipated in the documentation, (“If you want to install yesod painlessly, get ghc >= 7.” from the install help wiki page. ) 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 1.10.2.0 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.


Features

This is an overview of features as supported directly by code in published packages. When a feature is listed as "no special support" for a framework, it usually means you could somewhat trivially add the support yourself by integrating existing packages into the framework.

  Happstack Snap Yesod
Version Control darcs git git
Server lazy IO (being rewritten with pipes) enumerator conduit
Code Reloading plugins hint yes
Scaffolding not maintained three templates one template, interactive options
Extensibility monad transformers snaplets subsites
Configuration records configurator type classes, yaml
Routing Combinators yes yes yes, with yesod-pure
Type-safe Routing web-routes fully supported no special support, but can integrate web-routes manually template-haskell DSL
Logic-free Templating heist supported heist fully supported and preferred no special support
Embedded Templating hsp and blaze-html fully supported can use blaze-html in heist splices, but discouraged hamlet fully supported
JavaScript jmacro, fay fay julius, fay
Form Processing reform digestive-functors yesod-form
Client Sessions SafeCopy a => a HashMap Text Text Map Text ByteString
Authentication
Authorization
External Databases no special support (unless you count acid-state's "remote" backend) several snaplets persistent
Internal Databases acid-state (via documentation and happstack-foundation) snaplet-acid-state, snaplet-sqlite-simple persistent-sqlite