Skip to content

Instantly share code, notes, and snippets.

@longliveenduro
Created January 3, 2014 17:12
Show Gist options
  • Select an option

  • Save longliveenduro/8241939 to your computer and use it in GitHub Desktop.

Select an option

Save longliveenduro/8241939 to your computer and use it in GitHub Desktop.
import scalaz._
import Scalaz._
object validationFailFast {
case object ParseError
case class Person(firstName: String, lastName: String)
val success1 = "first".success[ParseError.type].toValidationNel
val success2 = "last".success[ParseError.type].toValidationNel
val result = (success1 |@| success2) { Person(_ , _) }
println(result)
// prints : Success(Person(first,last))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment