Input request: which interface for Web Application Interface

I've made a few more changes to WAI since my last update. Namely, request and response headers are now their own datatype. As with Method, HttpVersion and Status, they both provide constructors for "everything else" and have functions to convert to/from bytestrings. This makes the package a bit more consistent, as well as giving us some more type safety and perhaps even some (negligible) performance gains. (Thanks again to Mark for the idea.) Another feature that will be added is a wrapper module. This will provide convenience functions for accessing the request body and generating a response body via other methods. For example, it will provide a lazy I/O interface for the request body and generating a response from a lazy bytestring. (Thanks to Nicolas for the idea.) The reason that it has not been written yet is because I have two options available for the request and response body interfaces. One is a direct copy of Hyena's enumerators, sans impredicative types. The other is a simpler I/O interface. Here are the benefits of each as I see it: Hyena enumerators: Provide accumulating parameter support. Provide mechanism for early response termination. Probably makes the server side of the request body simpler to program. Simple interface: More obvious how to use it. Makes the application side of the request body simpler to program. You can see the code for each in github: Enumerator: http://github.com/snoyberg/wai/blob/enumerator/Network/Wai.hs Simple: http://github.com/snoyberg/wai/blob/master/Network/Wai.hs I'm currently leaning to the enumerator approach, since it should be simple application side to wrap the enumerator into a more tractable interface. However, I'd like to hear people's opinions on this. To get an idea of how this changes code, I'm attaching a diff of the two branches, which includes a simple HTTP server and application. I'm also aware that documentation is sorely lacking right now; once we come to a decision on this piece of the interface, I'll add the wrapper functions and comment appropriately. Commenting at this stage would be putting the cart before the horse. Michael
participants (1)
-
Michael Snoyman