Implement callbacks as monads.