[Haskell-cafe] Logging pure code

Joey Adams joeyadams3.14159 at gmail.com
Sun Jul 29 20:16:27 CEST 2012

On Fri, Jul 27, 2012 at 9:52 AM, Marco Túlio Gontijo e Silva
<marcotmarcot at gmail.com> wrote:
> I thought that the only thing I needed to take care while using
> unsafePerformIO was knowing that the time of execution is undetermined
> and that it could even run more than once.  This is not a problem for
> my logging.  Is there something else I should be aware while using
> unsafePerformIO?

Another thing to be aware of is that unsafePerformIO and STM don't
interact well.  In particular, STM will abort doomed transactions.  If
the transaction is IO that has exception handlers set up, those
handlers won't be run.  This is the case for unsafeIOToSTM, but I'm
not sure if it's the case for unsafePerformIO as well.

Are you using STM in your program?  Also, what version of GHC are you using?


More information about the Haskell-Cafe mailing list