[Snap Framework] Detecting client disconnects

tsuraan tsuraan at gmail.com
Fri Jan 28 11:22:04 CST 2011

> Within the iteratee enumerator you use to send the data, it should be
> possible to use catchError and/or the MonadCatchIO typeclass instance
> to attach a "finally" handler to your code.

I don't think I understand Haskell well enough to make sense of what's
going on here.  catchError takes an Iteratee and a function that
transforms an exception into an Iteratee, and returns a third
Iteratee.  The typical Snap handler function is of type Snap (), and
the functions I've been using (writeBS, modifyResponse) also return "m
()", where m is a Snap.  I don't see what I need to do to lift my Snap
() functions into Iteratee functions so that I can use catchError on
them.  Am I missing something obvious?  I'm still pretty shaky on
Haskell's types, so I'm guessing there's something that I just don't
understand about how Iteratees and Snap () types work together.

More information about the Snap mailing list