[Haskell-cafe] Web application interface
Nicolas Pouillard
nicolas.pouillard at gmail.com
Fri Jan 15 10:06:59 EST 2010
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 at n-heptane.com> 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
More information about the Haskell-Cafe
mailing list