Saturday, July 18, 2009

Solutions to Chapter 14 (p. 352)

#1. Note that the example down the page gives bold hints. The solution is:

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

No comments:

Post a Comment