[Haskell-cafe] Haskell Web Framework Happstack 6 Released

Jeremy Shaw jeremy at n-heptane.com
Fri Feb 18 00:15:02 CET 2011


I am pleased to announce the release of Happstack 6. We fully  
recommend that all Happstack users migrate to the new release.

Happstack is a high-performance Haskell web framework. It has high- 
level functionality for routing requests, extracting parameters,  
manipulating responses, serving static file contents, compression  
responses, and more. It includes an integrated HTTP server and a  
native RAM-cloud database system known as MACID. This allows you to  
deploy your web application with out having to configure apache, php,  
mysql, memcached, etc!

Install instructions can be found here:


If you are porting existing applications you should check out the  
Happstack 6 migration guide:


Porting should be pretty straight-forward. Despite the massive  
reorganization, the exports from Happstack.Server are largely the same.

What's Exciting!

The focus of this release has been happstack-server. The primary goal
was to make happstack-server much easier to learn and to use.

This includes:

  1. improving the overall organization of the library
  2. greatly improving the documentation
  3. making it easier to install
  4. ensuring that the server provides fast, reliable performance
  5. making it easier for new (and old) developers to understand and  
get started

If you have looked at Happstack before and found it too difficult to  
understand, I highly recommend you take another look. The new  
organization and documentation make it far easier to understand.

More Logical Organiation

In prior versions, the Happstack.Server.SimpleHTTP module contained  
just about everything, with little organization, and no real  
differentiation between the external API and the library internals. In  
Happstack 6, SimpleHTTP has been refactored into numerous, smaller  
modules. The internals have been moved into  
Happstack.Server.Internal.* so that they are not leaking into the  
external API. This should make it much easier to find what you are  
looking for, and prevent you from accidently running across internal  
things like the WebT monad, which you do not really need to know  
anything about.

Better Documentation

The API documentation for happstack-server is also much better. All  
external API functions should now have good haddock documentation with  
many inline examples.

However, learning a new library by studying the API documentation can  
still be pretty frustrating. So we also have the brand new Happstack  
Crash Course. http://happstack.com/docs/crashcourse/index.html.

The Happstack Crash Course covers a vast majority of the happstack- 
server API. It covers the API in a logical manner and includes many  
downloadable, runnable examples. It is intended to be read start to  
finish, and to also be usable as a reference guide for specific "How  
do I do XXX" questions.

Additionally, the guestbook example has been updated to a cleaner,  
more modern style of Happstack coding. It also has more comments/ 
haddock documentation.

Better API

During the process of documenting Happstack, many small improvements  
where made to the API. Once you try to document something stupid you  
realize how stupid it is and decided it would be good to fix it first ;)

For example, the Cookie API now makes it more obvious how to create  
session cookies vs persistent cookies. And makes it obvious how to  
expire a cookie.

The functions for looking up values in the query string and require  
body no longer require the use of the RqData monad. You can use the  
look* functions directly in the ServerPart monad.

If you do choose to use RqData, it now has an Applicative instance  
which can accummulate and report lookup errors. (http://happstack.blogspot.com/2010/10/is-rqdata-monad-still-needed.html 
) There are a bunch of other improvements to request data handling  
documented here, http://happstack.com/docs/crashcourse/RqData.html.

Easier Install

In order to make Happstack easier to install we have removed as many  
dependencies as possible. happstack-data no longer depends on  
happstack-util, which makes it easier to install happstack-data or  
happstack-state with out the rest of the framework. HSP and  
HStringTemplate support has been moved into *optional* happstack-hsp  
and happstack-hstringtemplate packages.

New Features

Happstack also has a number of new features including:

  - support for Heist templates    (http://happstack.com/docs/crashcourse/Templates.html#helloheist 
  - support for Hamlet templates
  - improved environment for extracting query string and form values (http://happstack.blogspot.com/2010/10/is-rqdata-monad-still-needed.html 
  - support for recompilation and reloading of templates in a running  
server (http://happstack.blogspot.com/2010/10/recompile-your-haskell-based-templates.html 
  - directory browsing when using serveDirectory

And numerous other improvements including enhancements to IxSet, file  
locking, and much more.

Bigger, Better Version Number

We have also upgraded our version numbers! We have decided to call  
this release Happstack 6.0 instead of Happstack 0.6. There are two  
reasons for this:

  1. the amount of changes we are making really do represent a new  
major release
  2. it will make it easier to comply with the Haskell package version  

Now that Happstack 6 is out, we plan to make more frequent releases.  
The new version scheme will allow us to talk about the next major  
release (Happstack 7), but still put out changes to Happstack 6 which  
change the API (aka, Happstack 6.2, etc).

GHC 7 - mostly

Happstack mostly works with GHC 7. Due to some compiler bugs, HSP does  
not work with GHC 7.0.1. These bugs were reported and are fixed in the  
upcoming GHC 7.0.2 release. If you are not using the optional  
happstack-hsp package, then GHC 7 is fine. If you are using happstack- 
hsp, then you will need to use GHC 6.12, a recent version of GHC from  
darcs, or wait until GHC 7.0.2 comes out.

The Future

The current future plan looks like this:

Happstack 7

The next major release of Happstack will be Happstack 7. The primary  
focus of Happstack 7 will be improving happstack-state (also known as  
MACID). Big features include:

  - sharding support
  - a rewrite of IxSet based on kdtrees with much better RAM and CPU  
  - performance testing to show how awesome MACID is
  - much better documentation and examples
  - better tools for examining and modifying state in running  

There are also a bunch of lower-level API improvements planned which  
should make it nicer to use happstack-state.

Happstack 8

Happstack 8 will finally feature an enumerator-based HTTP backend.  
This is a feature we have been hoping to add since January of 2009.


Rather than develop a competing HTTP backend, Happstack will put its  
efforts into improving an existing HTTP backend. We currently have our  
eye on WAI/warp. However, we will also consider snap and hyena when  
the time comes.

It should be noted that the current lazy I/O based backend is not the  
relentless nightmare of space leaks that some people might lead you to  
believe it is. The current happstack-server can easily handle uploads  
and downloads of large or streaming files with out leaks. But,  
enumerators *are* nice.

How You can Help

You are encouraged to get involved in Happstack. The easiest way to  
get involved is to complain about how horrible Happstack is. If you  
don't voice your complaints, then we might not know something things  
to be fixed.

If you are looking to make code contributions, please feel free to ask  
on #happs or the mailing list. There are tasks that are easy for  
novices, tasks that are worthy of a Ph.D, and everything in between.  
If you want to work, we can certainly find a way to use your talents!

There are also plenty of non-coding related tasks including  
documentation, graphic design, user surveys, etc.

You are also encouraged to blog about your Happstack projects!

- jeremy shaw

More information about the Haskell-Cafe mailing list