[Haskell-cafe] STM and random numbers

Chad Scherrer chad.scherrer at gmail.com
Fri Jan 12 14:01:32 EST 2007

Wow, lots of great ideas. Thanks, guys.

I worry about the uncertainty in the semantics that seems to be
introduced by the unsafe stuff. But I actually hadn't noticed
GHC.Conc.unsafeIOToSTM before, so it's good to know it's there.

Even if I use randomIO outside the STM code, I don't know of a (safe)
way to bring it in. Anyway, the number of random values needed depends
on other stuff going on within the STM part.

I think setStdGen has the same problem as just using randomIO and
ignoring the initial seed - there's no nice way of moving the (IO a)
value generated into the STM monad.

Rob, Henning,
I think I'll take this approach, or something similar. Thanks for the pointers.


More information about the Haskell-Cafe mailing list