ä¸è¨ã§åãä¸ãããã¦ãããã¿ã«ã¤ãã¦ã¡ã¢ãæ®ãã Scala ã® Either ã«ã¤ãã¦ã®èå¯ - scalaã¨ãã»ã»ã» Scalaåå¼·ä¼ç¬¬53å (EitherãScalazã®Validationã«ã¤ãã¦) - Togetter Either 㨠Scalaz Either 㯠flatMap ã¡ã½ãããæããªãã®ã§ for å¼ã§ã¯ä½¿ããªããfor å¼å 㧠Right ã§å¦çãé²ããããªã right ã¡ã½ããã§ãLeft ã§å¦çãé²ããããªã left ã¡ã½ãã㧠*Projection ãåå¾ããå¿ è¦ãããã def r(n: Int): Either[String, Int] = Right(n) for { x <- r(1).right; y <- r(x).right } yield x+y ã¨ã¯ãããå¤ãã®å ´å Right ã§å¦çãé²ãããå ´åãå¤ããLeft ã§å¦çãé²ã
{{#tags}}- {{label}}
{{/tags}}