Skip to content

Instantly share code, notes, and snippets.

@jamesward
Last active November 15, 2017 23:28
Show Gist options
  • Save jamesward/77fef330919743f81e48a44f05c02819 to your computer and use it in GitHub Desktop.
Save jamesward/77fef330919743f81e48a44f05c02819 to your computer and use it in GitHub Desktop.
  implicit class TryWithForNot[T](t: Try[T]) {
    def fornot[A](f: Throwable => A): Unit = ???
  }

  implicit class SuccessWithForNot[T](success: Success[T]) {
    def fornot[A](f: Throwable => A): Unit = ()
  }

  implicit class FailureWithForNot[T](failure: Failure[T]) {
    def fornot[A](f: Throwable => A): Unit = {
      f(failure.exception)
      ()
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment