Skip to content

Commit

Permalink
Make catchNonFatal on Future async (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek authored Jan 3, 2017
1 parent 5bcb62f commit 86ee0ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/scala/cats/instances/future.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ trait FutureInstances extends FutureInstances1 {
override def recoverWith[A](fa: Future[A])(pf: PartialFunction[Throwable, Future[A]]): Future[A] = fa.recoverWith(pf)

override def map[A, B](fa: Future[A])(f: A => B): Future[B] = fa.map(f)

override def catchNonFatal[A](a: => A)(implicit ev: Throwable <:< Throwable): Future[A] = Future(a)

override def catchNonFatalEval[A](a: Eval[A])(implicit ev: Throwable <:< Throwable): Future[A] = Future(a.value)
}
}

Expand Down

2 comments on commit 86ee0ac

@mcanlas
Copy link

@mcanlas mcanlas commented on 86ee0ac Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the (implicit ev: Throwable <:< Throwable) bit for?

@johnynek
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it just has to be there because the type is (implicit ev: E <:< Throwable) but here E is Throwable.

Please sign in to comment.