Skip to content

Commit

Permalink
f => f andThen G.void
Browse files Browse the repository at this point in the history
  • Loading branch information
takayahilton committed Aug 4, 2020
1 parent 1470081 commit 4b78114
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/scala/cats/Reducible.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ import scala.annotation.implicitNotFound
* available for `G` and want to take advantage of short-circuiting
* the traversal.
*/
def nonEmptyTraverse_[G[_], A, B](fa: F[A])(f: A => G[B])(implicit G: Apply[G]): G[Unit] =
G.void(reduceRightTo(fa)(f)((x, y) => G.map2Eval(f(x), y)((_, b) => b)).value)
def nonEmptyTraverse_[G[_], A, B](fa: F[A])(f: A => G[B])(implicit G: Apply[G]): G[Unit] = {
val f1 = f andThen G.void
reduceRightTo(fa)(f1)((x, y) => G.map2Eval(f1(x), y)((_, b) => b)).value
}

/**
* Sequence `F[G[A]]` using `Apply[G]`.
Expand Down

0 comments on commit 4b78114

Please sign in to comment.