On 09-Aug-2000, Carl R. Witty <[EMAIL PROTECTED]> wrote:
> Norman Ramsey <[EMAIL PROTECTED]> writes:
>
> > Does anybody know of work using monads to encapsulate a source of
> > random numbers? A quick web search suggested Haskell 98 did not take
> > this path. I'd be curious for any insights why, or any suggestions
> > about a `randomness monad'.
>
> My guess as to why Haskell 98 does not provide a stand-alone
> "randomness monad" is that monads are annoying (impossible in general)
> to combine.
Another reason is that some people favour an approach using the
`Random.split' function in preference to using a monad.
Using a monad imposes a sequence on things, whereas using the
`Random.split' function, you can distribute a sequence of random
numbers to several function calls without imposing any sequence.
The resulting code is thus more symmetric and (at least in theory)
more easily parallelizable.
(However, little work has been done on ensuring good randomness of
sequences generated using `Random.split', so if you need high quality
randomness then I would not advise that approach at this point in time.)
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.