Skip to content

Instantly share code, notes, and snippets.

View todokr's full-sized avatar
😻
Focusing

Shunsuke Tadokoro todokr

😻
Focusing
View GitHub Profile
@todokr
todokr / scalaz-validation.scala
Created November 30, 2016 01:03 — forked from manjuraj/scalaz-validation.scala
scalaz validation
//
// Validation[E, A] represents either:
// - Success[A]
// - Failure[E]
//
// Isomporphic to scala.Either[E, A] and scalaz.\/[E, A]
//
// Unlike \/[E, A], Validation is not a Monad, but an Applicative
// Functor. So if you want to use it as a Monad you can convert back
// and forth using the `validation` and `disjunction` method
@todokr
todokr / scalaz-disjunction.scala
Created November 30, 2016 01:01 — forked from manjuraj/scalaz-disjunction.scala
scalaz disjunction
//
// Disjunction - aka Scalaz Either
// \/[A, B] is an alternative to Either[A, B]
// -\/ is Left (usually represents failure by convention)
// \/- is Right (usually represents success by convention)
// Left or Right - which side of the Disjunction does the "-" appear?
//
// Prefer infix notation to express Disjunction Type v: String \/ Double
//
// References