[Haskell-cafe] ANN: Happstack 7

Jeremy Shaw jeremy at n-heptane.com
Fri Mar 30 15:58:42 CEST 2012

On Fri, Mar 30, 2012 at 4:36 AM, Lennart Kolmodin <kolmodin at gmail.com>wrote:

> Congratulations to the new release, and may I say that the homepage looks
> smashing! :D


> Before I saw happstack-wai I had a quick look at the happstack API and saw
> that the Request keeps the request body as a (lazy?) String.

Hmm. I am not sure what you are referring to.

Looking a the Request type:


we see that the rqBody as the type:

    rqBody :: MVar RqBody

and RqBody is defined as:

newtype RqBody = Body { unBody :: L.ByteString } deriving

So, it is, as you would expect, a lazy ByteString. RqData is defined as a
ByteString in HAppS as well.. so it is always been that way in Happstack.

The MVar is there so that you can process the request body as it streams
over the network and have it garbage collected as you go. For example, when
saving a file upload to disk, the whole file does not get sucked into RAM.

There are other places in happstack-server where we use String instead of
ByteString or Text. That is mostly because happstack was started back in
2004. So, I am pretty sure it predates the existence of ByteString, and it
is definitely older than Text.

Most places that should be a ByteString have been updated. Not all places
that could be Text are yet. We will see more modernization in that area in
Happstack 8.

- jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120330/329d8b32/attachment.htm>

More information about the Haskell-Cafe mailing list