f : X => ValidationNEL[E, A]g : A => ValidationNEL[E, B]h : B => ValidationNEL[E, C]
(f andThen g andThen h) apply x
((f(x) map g) join) map h join.
--
You received this message because you are subscribed to the Google Groups "scalaz" group.
To post to this group, send email to sca...@googlegroups.com.
To unsubscribe from this group, send email to scalaz+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/scalaz?hl=en.
scala> def kleisli1Of2[M[_,_], A, B, S](f : A => M[S,B]) = kleisli[PartialApply1Of2[M, S]#Apply, A, B](f)kleisli1Of2: [M[_,_],A,B,S](f: (A) => M[S,B])scalaz.Kleisli[[B]M[S,B],A,B]
scala> kleisli1Of2(f) >=> kleisli1Of2(g) >=> kleisli1Of2(h)res7: scalaz.Kleisli[[B]scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],B],String,Float] = scalaz.Kleislis$$anon$1@3ef91c8fscala> res7("1")res8: scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],Float] = Success(3.0)scala> res7("0")res9: scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],Float] = Failure(NonEmptyList(java.lang.NumberFormatException: FALSE))scala> res7("2")res10: scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],Float] = Failure(NonEmptyList(java.lang.NumberFormatException: Not a bool: 2))scala> res7("a")res11: scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],Float] = Failure(NonEmptyList(java.lang.NumberFormatException: For input string: "a"))
scala> (kleisli1Of2(f) >=> kleisli1Of2(g) >=> kleisli1Of2(h))("1")
I get an error saying
<console>:15: error: type mismatch;
found : java.lang.String("1")
required: scalaz.Bind[[B]scalaz.Validation[scalaz.NonEmptyList[NumberFormatException],B]]
(kleisli1Of2(f) >=> kleisli1Of2(g) >=> kleisli1Of2(h))("1")
^
Assigning to a val and then invoking that works, but for some reason
the direction invocation fails. Any idea why?
Thanks,
Rich
Try calling k.apply("1") directly.