[Haskell-cafe] On the purity of Haskell /Random generators
Chris Smith
cdsmith at gmail.com
Thu Dec 29 22:26:41 CET 2011
On Thu, 2011-12-29 at 21:04 +0000, Steve Horne wrote:
> 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.
This is certainly not legitimate. Anything that can't be memoized has
no business advertising itself as a function in Haskell. This matters
quite a lot... programs might change from working to broken due to
something as trivial as inlining by the compiler (see the ugly NOINLINE
annotations often used with unsafePerformIO tricks for initialization
code for an example).
--
Chris Smith
More information about the Haskell-Cafe
mailing list