Real World Haskell – Exercise Chapter 14

My solution to the exercise on p. 352.

1.Rewrite getRandom to use do notation.

getRandom :: Random a => RandomState a
getRandom = do
  gen <- get
  let (val,gen') = random gen
  put gen'
  return val

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string 0TQmN7 to the field below: