Advertisement
eallik

Untitled

Jan 6th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.46 KB | None | 0 0
  1.   type Va[A] = Validation[String, A]
  2.   type VaNel[A] = ValidationNel[String, A]
  3.  
  4.   implicit val vaBind = new Bind[Va] {
  5.     def map[A, B](fa: Va[A])(f: A => B): Va[B] = fa.map(f)
  6.  
  7.     def bind[A, B](fa: Va[A])(f: A => Va[B]): Va[B] =
  8.       fa.flatMap(f)
  9.   }
  10.  
  11.   implicit val vaNelBind = new Bind[VaNel] {
  12.     def map[A, B](fa: VaNel[A])(f: A => B): VaNel[B] = fa.map(f)
  13.  
  14.     def bind[A, B](fa: VaNel[A])(f: A => VaNel[B]): VaNel[B] =
  15.       fa.flatMap(f)
  16.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement