On Thu, Jan 12, 2012 at 22:56, Brandon Allbery <allber...@gmail.com> wrote: > On Thu, Jan 12, 2012 at 16:50, Andrew Coppin <andrewcop...@btinternet.com> > wrote: >> >> My guess is that your "debug printing" is causing something to be >> evaluated when it otherwise wouldn't be, causing a transaction to begin >> within a transaction. > > > My guess is something is being lazily evaluated as usual, but if that is > forced within a transaction, well, last I checked the GHC I/O system used > STM internally so unsafePerformIO debug prints could well cause nested > transactions. >
This could be it. If I'm computing a value atomically and then using this value in another transaction, I may nest transactions if the value isn't forced? x <- atomically $ foo let x' = someOp x atomically $ bar x' Is it necessary to use seq here, or is it merely the debug printing that's getting in the way? Also, if the GHC IO system is using STM internally, what would be the correct way to say write a file? (where the IO action can be retried safely but have to run at least once, idempotent?). Please don't say "don't" :-) -- Johan Brinch _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe