[Haskell-beginners] theStdGen unsafePerformIO

Antoine Latter aslatter at gmail.com
Sun Jan 9 17:14:56 CET 2011


You might get more answers to this sort of question on the
haskell-cafe list. Even there, I think you might need to ask whoever
the authors were for a question like this :-)

On Sun, Jan 9, 2011 at 9:55 AM, John Smith <voldermort at hotmail.com> wrote:
> Why does theStdGen require unsafePerformIO? I recompiled the Random module
> with
>
> theStdGen :: IO (IORef StdGen)
> theStdGen  = do
>                rng <- mkStdRNG 0
>                newIORef rng
>
> The implementations of a few functions needed to change slightly (to extract
> the IORef from IO), but no other type signatures needed changing, and
> nothing blew up.
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



More information about the Beginners mailing list