haskell-cafe@haskell.org
[Top] [All Lists]

Re: [Haskell-cafe] Web application interface

Subject: Re: [Haskell-cafe] Web application interface
From: Nicolas Pouillard
Date: Fri, 15 Jan 2010 16:06:59 +0100
Excerpts from Michael Snoyman's message of Thu Jan 14 17:32:26 +0100 2010:
> On Thu, Jan 14, 2010 at 5:42 PM, Jeremy Shaw <jeremy@xxxxxxxxxxxxx> wrote:
> 
[...]
> > I wonder if the 'Response' portion of WAI should support all three
> > currently used methods:
> >  - lazy I/O
> >  - Enumerator
> >  - sendFile
> >
[...]
> As for your proposal of three methods, I'm not sure if it's necesary. I
> understand that we would want sendfile for speedy serving of files straight
> from the filesystem, but it's fairly straight-forward to convert a lazy
> bytestring into an enumerator, and I don't think we get a performance
> penalty for doing so (if there's a benchmark otherwise, I'd be happy to see
> it).

It is indeed easy to convert a lazy bytestring to an enumerator. What is not
easy IMHO is to manipulate enumerators. I don't know if it is an issue in the
context of using Wai/Hack, but for instance writing hack middleware could
become a lot less fun. To be very specific how would you adapt
hack-middleware-gzip [1] ?

Regarding the unsafeness of lazy IO. I would like to recall the existence of
safe-lazy-io [2] which was announced and explained here [3].

Best regards,

[1]: http://hackage.haskell.org/package/hack-middleware-gzip
[2]: http://hackage.haskell.org/package/safe-lazy-io
[3]: http://www.haskell.org/pipermail/haskell/2009-March/021133.html

-- 
Nicolas Pouillard
http://nicolaspouillard.fr
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>