The validation monad in JS