M
- the outer stack-safe monad
A
- the carrier typepublic final class IdentityT<M extends MonadRec<?,M>,A> extends Object implements MonadT<M,A,IdentityT<M,?>,IdentityT<?,?>>
monad transformer
for Identity
.Modifier and Type | Method and Description |
---|---|
<B> IdentityT<M,B> |
discardL(Applicative<B,IdentityT<M,?>> appB)
Sequence both this
Applicative and appB , discarding this Applicative's
result and returning appB . |
<B> IdentityT<M,A> |
discardR(Applicative<B,IdentityT<M,?>> appB)
Sequence both this
Applicative and appB , discarding appB's result and
returning this Applicative . |
boolean |
equals(Object other) |
<B> IdentityT<M,B> |
flatMap(Fn1<? super A,? extends Monad<B,IdentityT<M,?>>> f)
Chain dependent computations that may continue or short-circuit based on previous results.
|
<B> IdentityT<M,B> |
fmap(Fn1<? super A,? extends B> fn)
Covariantly transmute this functor's parameter using the given mapping function.
|
int |
hashCode() |
static <M extends MonadRec<?,M>,A> |
identityT(MonadRec<Identity<A>,M> mia)
|
<B> Lazy<IdentityT<M,B>> |
lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,IdentityT<M,?>>> lazyAppFn)
Given a
lazy instance of this applicative over a mapping function, "zip" the two instances together
using whatever application semantics the current applicative supports. |
<B,N extends MonadRec<?,N>> |
lift(MonadRec<B,N> mb)
|
static Lift<IdentityT<?,?>> |
liftIdentityT()
|
<B> IdentityT<M,B> |
pure(B b)
Lift the value
b into this applicative functor. |
static <M extends MonadRec<?,M>> |
pureIdentityT(Pure<M> pureM)
|
<MIA extends MonadRec<Identity<A>,M>> |
runIdentityT()
Recover the full structure of the embedded
Monad . |
String |
toString() |
<B> IdentityT<M,B> |
trampolineM(Fn1<? super A,? extends MonadRec<RecursiveResult<A,B>,IdentityT<M,?>>> fn)
Given some operation yielding a
RecursiveResult inside this MonadRec , internally trampoline the
operation until it yields a termination instruction. |
<B> IdentityT<M,B> |
zip(Applicative<Fn1<? super A,? extends B>,IdentityT<M,?>> appFn)
Given another instance of this applicative over a mapping function, "zip" the two instances together using
whatever application semantics the current applicative supports.
|
public <MIA extends MonadRec<Identity<A>,M>> MIA runIdentityT()
Monad
.MIA
- the witnessed target typeMonad
public <B,N extends MonadRec<?,N>> IdentityT<N,B> lift(MonadRec<B,N> mb)
lift
in interface MonadBase<M extends MonadRec<?,M>,A,IdentityT<?,?>>
lift
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the MonadRec
carrier typeN
- the argument MonadRec
witnessmb
- the argument MonadRec
MonadBase
public <B> IdentityT<M,B> flatMap(Fn1<? super A,? extends Monad<B,IdentityT<M,?>>> f)
flatMap
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
flatMap
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
flatMap
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the resulting monad parameter typef
- the dependent computation over Apublic <B> IdentityT<M,B> trampolineM(Fn1<? super A,? extends MonadRec<RecursiveResult<A,B>,IdentityT<M,?>>> fn)
RecursiveResult
inside this MonadRec
, internally trampoline the
operation until it yields a termination
instruction.
Stack-safety depends on implementations guaranteeing that the growth of the call stack is a constant factor independent of the number of invocations of the operation. For various examples of how this can be achieved in stereotypical circumstances, see the referenced types.
trampolineM
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
B
- the ultimate resulting carrier typefn
- the function to internally trampolineMonadRec
for a basic implementation
,
for a {@link CoProduct2 coproduct} implementation
,
for an implementation leveraging an already stack-safe {@link Monad#flatMap(Fn1)}
,
for a {@link MonadT monad transformer} implementation
public <B> IdentityT<M,B> pure(B b)
b
into this applicative functor.pure
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
pure
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
pure
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
pure
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the type of the returned applicative's parameterb
- the valuepublic <B> IdentityT<M,B> fmap(Fn1<? super A,? extends B> fn)
fmap
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
fmap
in interface Functor<A,IdentityT<M extends MonadRec<?,M>,?>>
fmap
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
fmap
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
fmap
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the new parameter typefn
- the mapping functionpublic <B> IdentityT<M,B> zip(Applicative<Fn1<? super A,? extends B>,IdentityT<M,?>> appFn)
zip
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
zip
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
zip
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
zip
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the resulting applicative parameter typeappFn
- the other applicative instancepublic <B> Lazy<IdentityT<M,B>> lazyZip(Lazy<? extends Applicative<Fn1<? super A,? extends B>,IdentityT<M,?>>> lazyAppFn)
lazy
instance of this applicative over a mapping function, "zip" the two instances together
using whatever application semantics the current applicative supports. This is useful for applicatives that
support lazy evaluation and early termination.lazyZip
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
lazyZip
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
lazyZip
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
lazyZip
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the resulting applicative parameter typelazyAppFn
- the lazy other applicative instanceMaybe
,
Either
public <B> IdentityT<M,B> discardL(Applicative<B,IdentityT<M,?>> appB)
Applicative
and appB
, discarding this Applicative's
result and returning appB
. This is generally useful for sequentially performing side-effects.discardL
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
discardL
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
discardL
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
discardL
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the type of the returned Applicative's parameterappB
- the other Applicativepublic <B> IdentityT<M,A> discardR(Applicative<B,IdentityT<M,?>> appB)
Applicative
and appB
, discarding appB's
result and
returning this Applicative
. This is generally useful for sequentially performing side-effects.discardR
in interface Applicative<A,IdentityT<M extends MonadRec<?,M>,?>>
discardR
in interface Monad<A,IdentityT<M extends MonadRec<?,M>,?>>
discardR
in interface MonadRec<A,IdentityT<M extends MonadRec<?,M>,?>>
discardR
in interface MonadT<M extends MonadRec<?,M>,A,IdentityT<M extends MonadRec<?,M>,?>,IdentityT<?,?>>
B
- the type of appB's parameterappB
- the other Applicativepublic static <M extends MonadRec<?,M>,A> IdentityT<M,A> identityT(MonadRec<Identity<A>,M> mia)
public static <M extends MonadRec<?,M>> Pure<IdentityT<M,?>> pureIdentityT(Pure<M> pureM)