lpsmith/postgresql-simple — pull request #63 by joeyadams (2013-05-28 07:49:34+00:00)
Title: Fix fold so it can be nested

This fixes a couple bugs in `fold` and company:

* `fold` can't be nested, since it simply uses cursor name `fold`, leading to a conflict when `fold` is already in progress.

* If a SQL error is thrown from `fold`, it will lose the original exception to "current transaction is aborted, commands ignored until end of transaction block".

I almost considered releasing a `Database.PostgreSQL.Simple.Cursor` module (see [my cursor branch][1]). I'm not sure it's worthwhile, though, at least not in its current form.

[1]: https://github.com/joeyadams/postgresql-simple/tree/cursor