Interface Effect<A>
- Type Parameters:
A
- the argument type
- All Superinterfaces:
Applicative<IO<Unit>,
,Fn1<A, ?>> Cartesian<A,
,IO<Unit>, Fn1<?, ?>> Cocartesian<A,
,IO<Unit>, Fn1<?, ?>> Contravariant<A,
,Profunctor<?, IO<Unit>, Fn1<?, ?>>> Fn1<A,
,IO<Unit>> Functor<IO<Unit>,
,Fn1<A, ?>> Monad<IO<Unit>,
,Fn1<A, ?>> MonadReader<A,
,IO<Unit>, Fn1<A, ?>> MonadRec<IO<Unit>,
,Fn1<A, ?>> MonadWriter<A,
,IO<Unit>, Fn1<A, ?>> Profunctor<A,
IO<Unit>, Fn1<?, ?>>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A function returning "no result", and therefore only useful as a side-effect.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionLeft-to-right composition ofEffects
.Invoke this function explosively with the given argument.checkedApply
(A a) Invoke this function with the given argument, potentially throwing anyThrowable
.default <Z> Effect
<Z> Contravariantly mapA <- B
.default <Z> Effect
<Z> Contravariantly map over the argument to this function, producing a function that takes the new argument type, and produces the same result.discardR
(Applicative<C, Fn1<A, ?>> appB) Sequence both thisApplicative
andappB
, discardingappB's
result and returning thisApplicative
.static <A> Effect
<A> static <A> Effect
<A> effect
(SideEffect sideEffect) Create anEffect
from aSideEffect
;static <A> Effect
<A> fromConsumer
(Consumer<A> consumer) static <A> Effect
<A> noop()
Create anEffect
that accepts an input and does nothing;
-
Method Details
-
checkedApply
Description copied from interface:Fn1
Invoke this function with the given argument, potentially throwing anyThrowable
. -
toConsumer
- Returns:
- the
Consumer
-
apply
Invoke this function explosively with the given argument. -
andThen
Left-to-right composition ofEffects
. -
diMapL
Contravariantly map over the argument to this function, producing a function that takes the new argument type, and produces the same result.- Specified by:
diMapL
in interfaceCartesian<A,
IO<Unit>, Fn1<?, ?>> - Specified by:
diMapL
in interfaceCocartesian<A,
IO<Unit>, Fn1<?, ?>> - Specified by:
diMapL
in interfaceFn1<A,
IO<Unit>> - Specified by:
diMapL
in interfaceProfunctor<A,
IO<Unit>, Fn1<?, ?>> - Type Parameters:
Z
- the new argument type- Parameters:
fn
- the contravariant argument mapping function- Returns:
- an
Fn1
<Z, B>
-
contraMap
Contravariantly mapA <- B
.- Specified by:
contraMap
in interfaceCartesian<A,
IO<Unit>, Fn1<?, ?>> - Specified by:
contraMap
in interfaceCocartesian<A,
IO<Unit>, Fn1<?, ?>> - Specified by:
contraMap
in interfaceContravariant<A,
Profunctor<?, IO<Unit>, Fn1<?, ?>>> - Specified by:
contraMap
in interfaceFn1<A,
IO<Unit>> - Specified by:
contraMap
in interfaceProfunctor<A,
IO<Unit>, Fn1<?, ?>> - Type Parameters:
Z
- the new parameter type- Parameters:
fn
- the mapping function- Returns:
- the mapped Contravariant functor instance
-
discardR
Sequence both thisApplicative
andappB
, discardingappB's
result and returning thisApplicative
. This is generally useful for sequentially performing side-effects.- Specified by:
discardR
in interfaceApplicative<IO<Unit>,
Fn1<A, ?>> - Specified by:
discardR
in interfaceFn1<A,
IO<Unit>> - Specified by:
discardR
in interfaceMonad<IO<Unit>,
Fn1<A, ?>> - Specified by:
discardR
in interfaceMonadReader<A,
IO<Unit>, Fn1<A, ?>> - Specified by:
discardR
in interfaceMonadRec<IO<Unit>,
Fn1<A, ?>> - Specified by:
discardR
in interfaceMonadWriter<A,
IO<Unit>, Fn1<A, ?>> - Type Parameters:
C
- the type of appB's parameter- Parameters:
appB
- the other Applicative- Returns:
- this Applicative
-
fromConsumer
-
effect
Create anEffect
from aSideEffect
;- Type Parameters:
A
- any desired input type- Parameters:
sideEffect
- theSideEffect
- Returns:
- the
Effect
-
noop
Create anEffect
that accepts an input and does nothing;- Type Parameters:
A
- any desired input type- Returns:
- the noop
Effect
-
effect
- Type Parameters:
A
- the effect argument type- Parameters:
fn
- the function- Returns:
- the effect
-