Skip to content

Commit

Permalink
fix lawsJVM
Browse files Browse the repository at this point in the history
  • Loading branch information
satorg committed Oct 18, 2022
1 parent aa223ee commit 369860c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/ApplicativeErrorLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ trait ApplicativeErrorLaws[F[_], E] extends ApplicativeLaws[F] {
F.onError(F.pure(a)) { case x => f(x) } <-> F.pure(a)

def onErrorRaise[A](fa: F[A], e: E, fb: F[Unit]): IsEq[F[A]] =
F.onError(F.raiseError[A](e)) { case err => fb } <-> F.map2(fb, F.raiseError[A](e))((_, b) => b)
F.onError(F.raiseError[A](e)) { case _ => fb } <-> F.map2(fb, F.raiseError[A](e))((_, b) => b)

def adaptErrorPure[A](a: A, f: E => E): IsEq[F[A]] =
F.adaptError(F.pure(a)) { case x => f(x) } <-> F.pure(a)
Expand Down
2 changes: 1 addition & 1 deletion laws/src/main/scala/cats/laws/DeferLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait DeferLaws[F[_]] {

def deferDoesNotEvaluate[A](fa: Unit => F[A]): IsEq[Boolean] = {
var evaluated = false
val deferUnit = F.defer {
val _ = F.defer {
evaluated = true;
fa(())
}
Expand Down
4 changes: 2 additions & 2 deletions laws/src/main/scala/cats/laws/ShortCircuitingLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait ShortCircuitingLaws[F[_]] {
def foldMapKShortCircuits[A](fa: F[A], empty: A)(implicit F: Foldable[F]): IsEq[Long] = {
val size = fa.size
val maxInvocationsAllowed = size / 2
val f = new RestrictedFunction[A, Option[A]]((a: A) => None, maxInvocationsAllowed, Some(empty))
val f = new RestrictedFunction[A, Option[A]]((_: A) => None, maxInvocationsAllowed, Some(empty))

fa.foldMapK(f)
f.invocations.get <-> (maxInvocationsAllowed + 1).min(size)
Expand All @@ -44,7 +44,7 @@ trait ShortCircuitingLaws[F[_]] {
def foldMapKWontShortCircuit[A](fa: F[A], empty: A)(implicit F: Foldable[F]): IsEq[Long] = {
val size = fa.size
val maxInvocationsAllowed = size / 2
val f = new RestrictedFunction[A, Option[A]]((a: A) => None, maxInvocationsAllowed, Some(empty))
val f = new RestrictedFunction[A, Option[A]]((_: A) => None, maxInvocationsAllowed, Some(empty))

fa.foldMapK(f)(F, nonShortCircuitingMonoidK)
f.invocations.get <-> size
Expand Down

0 comments on commit 369860c

Please sign in to comment.