Skip to content

Commit

Permalink
More Applicative#unit to limit allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
TimWSpence committed Mar 5, 2024
1 parent eebed5b commit 803107d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala-2.13+/cats/instances/arraySeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private[cats] object ArraySeqInstances {
G match {
case x: StackSafeMonad[G] => Traverse.traverse_Directly(fa)(f)(x)
case _ =>
foldRight(fa, Always(G.pure(()))) { (a, acc) =>
foldRight(fa, Eval.now(G.unit)) { (a, acc) =>
G.map2Eval(f(a), acc) { (_, _) =>
()
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/seq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ trait SeqInstances extends cats.kernel.instances.SeqInstances {
G match {
case x: StackSafeMonad[G] => Traverse.traverse_Directly(fa)(f)(x)
case _ =>
foldRight(fa, Always(G.pure(()))) { (a, acc) =>
foldRight(fa, Eval.now(G.unit)) { (a, acc) =>
G.map2Eval(f(a), acc) { (_, _) =>
()
}
Expand Down

0 comments on commit 803107d

Please sign in to comment.