[Haskell-cafe] Re: Strictness, order of IO operations: NewCGI & HDBC

Tim Smith wrote:
Has anyone found out how to lift bracket into another monad?
Yes, please see the thread `Re: Control.Exceptions and MonadIO' staring at http://www.haskell.org/pipermail/haskell-cafe/2006-April/015444.html There is also a Haskell' ticket: http://hackage.haskell.org/trac/haskell-prime/ticket/110 We have used this CatchableMonadIO in takusen and the other project, with success. One wish is to have HUnit work in this CatchableMonadIO rather than just IO (currently Alistair Bayley has to maintain an adjusted version of HUnit for that purpose). Regarding the issue of proper disconnections from the database server: it was the thrust for the development of Takusen is to statically prevent errors like forgetting to disconnect from the database or to use the database connection after disconnecting (as well as related issues of using a cursor after closing it, or forgetting to close the cursor or to dispose the resultset). As to performance: Takusen can read and process 2 million rows from the database, in the same space it takes to fetch and process 10 rows. In fact, doing this is one of the performance tests.

Oleg,
On 10/20/06, oleg@pobox.com
Tim Smith wrote:
Has anyone found out how to lift bracket into another monad?
Yes, please see the thread `Re: Control.Exceptions and MonadIO' staring at http://www.haskell.org/pipermail/haskell-cafe/2006-April/015444.html
That's just what I needed. I think it would have taken me 3 years to figure out that solution on my own. instance CaughtMonadIO m => CaughtMonadIO (CGIT m) where gcatch a handler = CGIT $ gcatch (unCGIT a) (\e -> unCGIT (handler e)) That, plus an instance declaration for WriterT, makes it work! Using gbracket, along with deepSeq when needed, should improve the structure of the program a lot. I hope Haskell' gets something like this accepted. And, thanks again to John G. and others who chimed in on this - it's much appreciated. Thank you, Tim -- If you're not part of the solution, you're part of the precipitate.
participants (2)
-
oleg@pobox.com
-
Tim Smith