[Haskell-cafe] MonadCatchIO-transformers and ContT

2010-06-21 Thread Michael Snoyman
Hi cafe, I ran into a segfault while working on some database code. I eventually traced it back to a double-finalizing of a statement (read: freeing memory twice), which ultimately led back to switching my code to use the ContT monad transformer. I was able to isolate this down to a minimal test

Re: [Haskell-cafe] MonadCatchIO-transformers and ContT

2010-06-21 Thread Neil Brown
Hi, Here's my guess. Take a look at this version, and try running it: === {-# LANGUAGE PackageImports #-} import qualified MonadCatchIO-transformers Control.Monad.CatchIO as C import Control.Monad.IO.Class import Control.Monad.Trans.Cont bracket_' :: C.MonadCatchIO m = m a -- ^

Re: [Haskell-cafe] MonadCatchIO-transformers and ContT

2010-06-21 Thread Michael Snoyman
I think you're correct, but I still don't know how to solve it. Any thoughts on that front? I'm at the point of just attaching a finalizer to the statement, or sticking in an IORef to ensure it doesn't get double-finalized. On Mon, Jun 21, 2010 at 2:04 PM, Neil Brown nc...@kent.ac.uk wrote:

Re: [Haskell-cafe] MonadCatchIO-transformers and ContT

2010-06-21 Thread David Menendez
On Mon, Jun 21, 2010 at 7:04 AM, Neil Brown nc...@kent.ac.uk wrote: Here's my speculation, based on glancing at the libraries involved: I believe the reason for this may be the MonadCatchIO instance for ContT: === instance MonadCatchIO m = MonadCatchIO (ContT r m) where   m `catch` f =