Generating random values in Haskell

I am using the Real World Haskell book. The statement

ghci> generate 10 (System.Random.mkStdGen 2) arbitrary :: [Bool]

results in

<interactive>:8:1: error:
* Couldn't match expected type `StdGen -> Gen a1 -> [Bool]'
              with actual type `IO a0'
* The function `generate' is applied to three arguments,
  but its type `Gen a0 -> IO a0' has only one
  In the expression: generate 10 (mkStdGen 2) arbitrary :: [Bool]
  In an equation for `it':
      it = generate 10 (mkStdGen 2) arbitrary :: [Bool]

If I am reading the error correctly it seems that "System.Random.mkStdGen 2" is now generating a monad? How do I get this statement to work?



from Recent Questions - Stack Overflow https://ift.tt/3swqzyR
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations