[Haskell-cafe] question about STM and IO

Stephan Friedrichs stephan.friedrichs at tu-bs.de
Tue Feb 12 13:41:45 EST 2008


John Lato wrote:
> I was recently looking at the STM library, and I have a question about
> the function "unsafeIOToSTM".  Can anyone explain to me what is unsafe
> about it, and what sort of use would be considered "safe"?

it's unsafe to perform IO inside of a transaction as it can't be undone, 
when rolling it back. I guess, unsafeIOToSTM has been designed in order 
to allow us to inject debugging output into a transaction, but you 
really shouldn't use it to perform "real" IO (like writing files, etc.).

HTH - Stephan


Früher hieß es ja: Ich denke, also bin ich.
Heute weiß man: Es geht auch so.

  - Dieter Nuhr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080212/4f4c403e/signature.bin

More information about the Haskell-Cafe mailing list