[Haskell-cafe] On the purity of Haskell /Random generators
Steve Horne
sh006d3592 at blueyonder.co.uk
Thu Dec 29 22:04:12 CET 2011
On 29/12/2011 20:39, Jerzy Karczmarczuk wrote:
> Still, I dont understand what does S.H. mean by a "perfectly good
> pure generator".
> Tell more please (unless you just mean a stream, say:
>
Probably bad wording, to be honest. I only meant that there's random
number handling support in the Haskell library and, and least judging by
type signatures, it's pure functional code with no hint of the IO monad.
AFAIK there's no hidden unsafePerformIO sneaking any entropy in behind
the scenes. Even if there was, it might be a legitimate reason for
unsafePerformIO - random numbers are in principle non-deterministic, not
determined by the current state of the outside world and
which-you-evaluate-first should be irrelevant. If you have a quantum
genuine-random-numbers gadget, the IO monad might be considered
redundant for functions that get values from it - though it still isn't
referentially transparent as it returns a different value each time even
with the same parameters.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111229/0781d49a/attachment.htm>
More information about the Haskell-Cafe
mailing list