A functor with application, providing operations to
- embed pure expressions ('pure'), and
- sequence computations and combine their results ('<*>' and 'liftA2').
A minimal complete definition must include implementations of 'pure' and 'liftA2'.
Further, any definition must satisfy the following:
Identity
pure[F](identity) <*> fa == fa
Composition
pure[F](compose) <*> fa <*> fb <*> fc == fa <*> (fb <*> fc)
Homomorphism
pure[F](f) <*> pure(x) == (pure[F](f(x)))
Interchange
u <*> pure(y) == pure[F]((f: String => String) => f(y)) <*> u
- Companion
- object
class Object
trait Matchable
class Any
Value members
Extensions
Extensions
extension (fa: F[A])
@targetName("productRight")
Sequence actions, discarding the value of the first argument.
Sequence actions, discarding the value of the first argument.
- Example
Option(1) *> Option(2) <* Option(3) == Option(2)
@targetName("productLeft")
Sequence actions, discarding the value of the second argument.
Sequence actions, discarding the value of the second argument.
- Example
Option(1) *> Option(2) <* Option(3) == Option(2)
Conditional execution of 'Applicative' expressions.
Conditional execution of 'Applicative' expressions.
- Example
doSomething.unless(condFailed)