Complete Indexed State monad example.