I have been continuing very slowly with my Haskell blog. Yesterday I properly pulled out the Django -inspired framework I am writing alongside it, and called it Ella, after another jazz genuis (though a vocalist — I much prefer vocal jazz).
There were a number of reasons I didn’t like the existing Haskell CGI package, but one of the biggest was the lack of explicit request and response objects. Instead of that it did everything inside a CGI monad, which makes it impossible to do things like reusable pre-processing of the request and post-processing of the response, both of which I will want to be able to do. I wanted something much more in the style of Django, with explicit request and response objects, something, ironically, much more functional instead of imperative — it is a surprise that I got this from a Python web framework. There were also things about the CGI API itself I really didn’t like (e.g. didn’t differentiate between GET and POST inputs). Plus, I wanted to have a go at some real Haskell, so I rolled my own.
It is very early days at the moment, and many big things are missing from the API (like proper access to GET and POST parameters, handlers for file uploads, any kind of HTML helpers for form handling etc). I realised that the API for all of that should only be implemented as I needed it in my actual software, otherwise I would just get it wrong. What is implemented so far is a strongly-typed routing mechanism, and not much more. It is enough, though, to implement a useful app — I wrote a very simple 80-line script that handles (via clickable URLs in emails) subscription to a personal mailing list I’m organising for myself. It also acts as an example at the moment — see ConfirmCgi.hs
Currently there is no home page, though there is some good documentation, and you can get the source. All of the API is subject to change at any time, but I think what I’ve done so far is a reasonable basis.