Skip to content

Instantly share code, notes, and snippets.

@khalidr
Last active August 29, 2015 14:14
Show Gist options
  • Save khalidr/38a2c2f18548afd8274f to your computer and use it in GitHub Desktop.
Save khalidr/38a2c2f18548afd8274f to your computer and use it in GitHub Desktop.
ApplicativeBuilder
case class Foo(f:String="",y:String,z:String)
object Foo{
type Val = Validated[Foo]
implicit val x = new Validator[Foo]{
def apply(v1: Foo): Validated[Foo] ={
import v1._
z.successNel[DomainValidationError] <*>(y.successNel[DomainValidationError] <*> (f.successNel[DomainValidationError] map (Foo.apply _).curried))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment