{- 
Purpose:
  Trace the the tick example Examples section of:
    http://hackage.haskell.org/packages/archive/mtl/latest/doc/html/Control-Monad-State.html#4
-}
module Main where

import Control.Monad.State

tick :: State Int Int
tick = do n <- get
          put (n+1)
          return n

plusOne :: Int -> Int
plusOne n = execState tick n

plus :: Int -> Int -> Int
plus n x = execState (sequence $ replicate n tick) x

main = do
  print (plusOne 2)
  print (plus 2 3)

