Walidacja parametrów metody w Scali, ze zrozumieniem i monadami

Próbuję sprawdzić poprawność parametrów metody pod kątem nieważności, ale nie mogę znaleźć rozwiązania ...

Czy ktoś może mi powiedzieć, jak to zrobić?

Próbuję czegoś takiego:

  def buildNormalCategory(user: User, parent: Category, name: String, description: String): Either[Error,Category] = {
    val errors: Option[String] = for {
      _ <- Option(user).toRight("User is mandatory for a normal category").right
      _ <- Option(parent).toRight("Parent category is mandatory for a normal category").right
      _ <- Option(name).toRight("Name is mandatory for a normal category").right
      errors : Option[String] <- Option(description).toRight("Description is mandatory for a normal category").left.toOption
    } yield errors
    errors match {
      case Some(errorString) => Left( Error(Error.FORBIDDEN,errorString) )
      case None =>  Right( buildTrashCategory(user) )
    }
  }

questionAnswers(4)

yourAnswerToTheQuestion