[web-devel] On the state of Haskell web frameworks

Nils Schweinsberg ml at n-sch.de
Sun Sep 19 18:50:39 CEST 2010

About one year ago, I started hacking on web projects with Haskell. One 
of my first web application was, just like hpaste, a simple paste bin:

Website: http://npaste.de/
Source: http://github.com/mcmaniac/npaste.de

npaste.de has currently over 3000 pastes and 13 registered users. You 
can use custom/random paste IDs, hide your paste or modify/delete them 
(if you have a user account). I did a lot of experiments in there and 
the source of npaste is therefor probably not very beautiful/easy to 
read. As my second "big" project I started just recently to turn my 
current "website" (a static index.html on n-sch.de) into a dynamic 
Haskell powered website with integrated blog, comment system etc. It's 
still in its early days, but the code can be found on:


Since I'm using happstack in all my projects (seems to be the most 
"complete" web framework to me) I released a small library 
"happstack-auth" on last friday, which is a high level library for user 
authentication/session managment in happstack applications. I wrote a 
very simple example website on how to use this library. It can be found on:

Website: http://n-sch.de/happstack-auth
Source: http://github.com/mcmaniac/happstack-auth/tree/master/demo/

My general approach for a new web project is:

> 1. CGI/FastCGI

Happstack for me. Setting up the happstack server is a simple 
"simpleHTTP appConf myWebapp" call, and happstack itself offers a lot of 
very nice functions to

> 2. highlighting-kate

Used it for npaste.de aswell, in combination with pandoc (markdown 

> 3. Takusen

Since I'm using happstack, I'm using happstack-state as my primary 
"database". Setting up the data types for the state and creating the 
functions to manipulate them is sometimes a bit of a mess (since it 
involves some template haskell etc), but I think it's worth it: You can 
use real haskell data types instead of having to think about a database 

In my latest "website-blog-project" I completly separated the state and 
the actual code of the website. Only a small, very nice API is returned:


> 4. ConfigFile

I usually just add a few lines to my Main.hs, so there is no big need 
for a config:


> 5. blaze-html/xhtml

I used HSP for a while, but I think Blaze is way more beautiful to use:


> 6. formlets

Didn't know about this lib. :) Gotta try it one day.

> 7. URI routing

Again, happstack is doing this very nicely:


> 8. Simple template writing

No template experience so far.

I'd say, once you *know* which libraries to use, it's very easy and 
uncomplicated to create a new website with haskell. But since there is 
no complete framework, the learning curve is a bit steep at the 
beginning and you'll have to do a lot of experiments before you realize 
what libraries are actually usefull.

By the way, did anyone use javascript on their websites? I wonder if 
there are any nice ways to combine those two worlds?

More information about the web-devel mailing list