
16 Sep
2014
16 Sep
'14
3:05 p.m.
On Tue, Sep 16, 2014 at 05:43:04PM +0000, Jeff C. Britton wrote:
Ok, I got it now. I was misunderstanding how the REPL was interacting with the IO Monad. I had once tried do { g <- newStdGen; take 10 $ randomRs (1,6) g }
but I actually needed this do { g <- newStdGen; return . take 10 $ randomRs (1,6) g }
Thanks, Jeff
I am sure you have already figured it out, but in case you didn't, this works too: λ> :m +System.Random λ> g <- newStdGen λ> take 10 $ randomRs (1,6) g [3,3,5,1,6,6,3,3,1,6] λ> (and keeps IO actions apart from pure code)