[Haskell-cafe] On the purity of Haskell /Random generators
jerzy.karczmarczuk at unicaen.fr
Thu Dec 29 22:51:50 CET 2011
Steve Horne :
> 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.
Look well at those functions, please.
Within the RandomGen class you have pure members, such as next (an Int
instance of what I called rgen in my previous message. It propagates the
seed "g" ). The algorithmics of the random generation has no particular
"monadicity" in it, as I said, the IO (or State) monad serves to hide
The generator itself should not be confounded with its iterative,
sequential usage. If people wanted to do in their programmes just *one*
read or write, never repeated, no IO Monad would be necessary.
On the other hand, for the IO, you can sequence the World instances
explicitly, without any Monads in a pure functional language, this is
the style used in Clean.
I am strongly convinced that ALL people who want to understand the
functional IO, refs, etc. should learn both, Haskell and Clean. Il might
help them to see better the relation between the programme, and its
/random numbers are in principle non-deterministic, not determined by
the current state of the outside world/
Sorry, but I haven't a slightest idea what you are talking about. Dybbuks?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe