[Haskell-cafe] On the purity of Haskell

Bardur Arantsson spam at scientician.net
Thu Dec 29 20:55:15 CET 2011


On 12/29/2011 08:47 PM, Steve Horne wrote:
> On 29/12/2011 19:21, Heinrich Apfelmus wrote:
>>
> BTW - why use an IO action for random number generation? There's a
> perfectly good pure generator. It's probably handy to treat it
> monadically to sequence the generator state/seed/whatever but random
> number generation can be completely pure.

*Pseudo* random number generation can of course be pure (though 
threading the state would be tedious and error-prone). If you want truly 
random numbers you cannot avoid IO (the monad).




More information about the Haskell-Cafe mailing list