A monad for remote computations