[web-devel] Hoogle Advice

Neil Mitchell ndmitchell at gmail.com
Tue Jan 25 22:56:09 CET 2011

>> 1) A way of finding how long a response took to generate.
>> 2) A way of finding out when exceptions happen.
>> Can either of these be achieved with middleware, or Response
>> transformers? I thought the timing one could probably be done by
>> consuming all the Response output, and then as a final action at the
>> end writing to an MVar or a Chan, which some other thread could read
>> from to see the time elapsed. Is that possible? It seems feasible...
> Are you talking about timing how long it takes to *generate* a
> response, or how long it takes to *send* a response? The latter would
> require changes to Warp which I do not want to make for the moment.

I want the generation time, but would accept send time as a rough approximation.

> The former would require forcing evaluation of your response body,
> which will kill any lazy IO advantages you have. However, it should be
> implementable at the application/middleware level.

I wondered if it was possible to do so keeping the lazy IO, but if not
it's not the end of the world.

> See the other email I just sent; I added a function runOnException.
> However, I think runEx is a nicer name, so I'm going to steal it. As
> for the requested type signature (including a Request): it's not
> really feasible at the Warp level: the exceptions Warp will be
> catching are not necessarily part of a request, it could be in the
> middle of receiving a request, a timeout in between one response and
> the next request, etc.

Fair enough. Generally, just not losing exceptions will be appreciated
- I don't expect exceptions to be common at all.

Thanks, Neil

More information about the web-devel mailing list