final class IfApplyOps[F[_]] extends AnyVal
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- IfApplyOps
- AnyVal
- Any
- Hide All
- Show All
Visibility
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
def
ifA[A](ifTrue: F[A], ifFalse: F[A])(implicit F: Apply[F]): F[A]
An
if-then-else
lifted into theF
context.An
if-then-else
lifted into theF
context. This function combines the effects of thefcond
condition and of the two branches, in the order in which they are given.The value of the result is, depending on the value of the condition, the value of the first argument, or the value of the second argument.
Example:
scala> import cats.implicits._ scala> val b1: Option[Boolean] = Some(true) scala> val asInt1: Option[Int] = b1.ifA(Some(1), Some(0)) scala> asInt1.get res0: Int = 1 scala> val b2: Option[Boolean] = Some(false) scala> val asInt2: Option[Int] = b2.ifA(Some(1), Some(0)) scala> asInt2.get res1: Int = 0 scala> val b3: Option[Boolean] = Some(true) scala> val asInt3: Option[Int] = b3.ifA(Some(1), None) asInt2: Option[Int] = None
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
toString(): String
- Definition Classes
- Any