I had always figured that Haskell's do-notation was just sugar for monad composition (>>=).
Then I came across this instance of it, and am not sure what monad is in use here, or whether there even is one:
rollDieThreeTimes :: (Die, Die, Die)
rollDieThreeTimes = do
let s = mkStdGen 0
(d1, s1) = randomR (1, 6) s
(d2, s2) = randomR (1, 6) s1
(d3, _) = randomR (1, 6) s2
(intToDie d1, intToDie d2, intToDie d3)
intToDie :: Int -> Die
...
My questions:
- Is there even a monad underlying the
do-notation of this example? - If not, is there some special form of
do-notation that permits this format oflet-statements with no monad? - If there is a monad, which is it? And, how would one convert this
do-notation into>>=form?