|
Scala example source code file (TryOps.scala)
The TryOps.scala Scala example source codepackage scalaz package syntax package std import scala.util.Try import scalaz.std.{`try` => t} final class TryOps[A](val self: Try[A]) extends AnyVal { final def cata[B](success: A => B, failure: Throwable => B): B = t.cata(self)(success, failure) final def toDisjunction: Throwable \/ A = t.toDisjunction(self) final def toValidation: Validation[Throwable, A] = t.toValidation(self) final def toValidationNel: ValidationNel[Throwable, A] = t.toValidationNel(self) } trait ToTryOps { implicit def ToTryOpsFromTry[A](a: Try[A]): TryOps[A] = new TryOps(a) } Other Scala examples (source code examples)Here is a short list of links related to this Scala TryOps.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.