Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz committed Jul 19, 2024
1 parent 5cdf69f commit 8853678
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala-2/cats/syntax/MonadOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ final class MonadOps[F[_], A](private val fa: F[A]) extends AnyVal {
M.flatMapOrKeep[A, A1](fa)(pfa)
def ifTrueM[B: Monoid](ifTrue: => F[B])(implicit env: F[A] <:< F[Boolean], M: Monad[F]): F[B] =
M.ifTrueM(fa)(ifTrue)
def ifFalseM[B: Monoid](ifFalse: => F[B])(implicit env: F[A] <:< F[Boolean],M: Monad[F]): F[B] =
def ifFalseM[B: Monoid](ifFalse: => F[B])(implicit env: F[A] <:< F[Boolean], M: Monad[F]): F[B] =
M.ifFalseM(fa)(ifFalse)
}
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/Monad.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ trait Monad[F[_]] extends FlatMap[F] with Applicative[F] {
* If the `F[Boolean]` is `true` then return `ifTrue` otherwise return `ifFalse`
*/
def ifTrueM[B: Monoid](fa: F[Boolean])(ifTrue: => F[B]): F[B] =
ifM(fa)(ifTrue, pure(Monoid[B].empty))
ifM(fa)(ifTrue, pure(Monoid[B].empty))

/**
* If the `F[Boolean]` is `false` then return `ifFalse` otherwise return `Monoid[A].empty`
Expand Down
4 changes: 2 additions & 2 deletions tests/shared/src/test/scala/cats/tests/MonadSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ class MonadSuite extends CatsSuite {
assert(actual.value === 2)
}

test("ifTrueM"){
test("ifTrueM") {
val actual1: Eval[Int] = Eval.later(true).ifTrueM(Eval.later(1))
assert(actual1.value === 1)

val actual2: Eval[Int] = Eval.later(false).ifTrueM(Eval.later(1))
assert(actual2.value === 0)
}

test("ifFalseM"){
test("ifFalseM") {
val actual1: Eval[Int] = Eval.later(true).ifFalseM(Eval.later(1))
assert(actual1.value === 0)

Expand Down

0 comments on commit 8853678

Please sign in to comment.