Monad using the Memory.t type