refine monad definition