Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The State Monad by Example
This is a short tutorial on the state monad. Emphasis is placed on intuition. The types have been simplified to protect the innocent.
runState (return 'X') 1
initial state = 1 :: Int final value = 'X' :: Char final state = 1 :: Int result = ('X', 1) :: (Char, Int)