[Haskell-cafe] Why do I need a 'do'?

Henning Thielemann lemming at henning-thielemann.de
Thu Apr 30 05:23:25 EDT 2009


On Wed, 29 Apr 2009, michael rice wrote:

> ==================
>
> import System.Random
>
> rollDice :: IO Int
> rollDice = getStdRandom (randomR (1,6))
>
> rollNDice :: Int -> [IO Int]
> rollNDice 0 = []
> rollNDice n = rollDice : rollNDice (n-1)


replicateM n rollDice

http://www.haskell.org/haskellwiki/Avoiding_IO#State_monad


More information about the Haskell-Cafe mailing list