_1
- The single slot element typepublic class SingletonHList<_1> extends HList.HCons<_1,HList.HNil> implements MonadRec<_1,SingletonHList<?>>, Traversable<_1,SingletonHList<?>>
HList.HCons<Head,Tail extends HList>, HList.HNil
Modifier and Type | Method and Description |
---|---|
<_0> Tuple2<_0,_1> |
cons(_0 _0)
Cons an element onto the front of this HList.
|
<_1Prime> SingletonHList<_1Prime> |
discardL(Applicative<_1Prime,SingletonHList<?>> appB)
Sequence both this
Applicative and appB , discarding this Applicative's
result and returning appB . |
<_1Prime> SingletonHList<_1> |
discardR(Applicative<_1Prime,SingletonHList<?>> appB)
Sequence both this
Applicative and appB , discarding appB's result and
returning this Applicative . |
<_1Prime> SingletonHList<_1Prime> |
flatMap(Fn1<? super _1,? extends Monad<_1Prime,SingletonHList<?>>> f)
Chain dependent computations that may continue or short-circuit based on previous results.
|
<_1Prime> SingletonHList<_1Prime> |
fmap(Fn1<? super _1,? extends _1Prime> fn)
Covariantly transmute this functor's parameter using the given mapping function.
|
<R> R |
into(Fn1<? super _1,? extends R> fn)
Apply
HList.HCons.head() to fn and return the result. |
<_1Prime> Lazy<SingletonHList<_1Prime>> |
lazyZip(Lazy<? extends Applicative<Fn1<? super _1,? extends _1Prime>,SingletonHList<?>>> 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. |
<_1Prime> SingletonHList<_1Prime> |
pure(_1Prime _1Prime)
Lift the value
b into this applicative functor. |
static Pure<SingletonHList<?>> |
pureSingletonHList()
The canonical
Pure instance for SingletonHList . |
<_1Prime> SingletonHList<_1Prime> |
trampolineM(Fn1<? super _1,? extends MonadRec<RecursiveResult<_1,_1Prime>,SingletonHList<?>>> fn)
Given some operation yielding a
RecursiveResult inside this MonadRec , internally trampoline the
operation until it yields a termination instruction. |
<B,App extends Applicative<?,App>,TravB extends Traversable<B,SingletonHList<?>>,AppTrav extends Applicative<TravB,App>> |
traverse(Fn1<? super _1,? extends Applicative<B,App>> fn,
Fn1<? super TravB,? extends AppTrav> pure)
Apply
fn to each element of this traversable from left to right, and collapse the results into
a single resulting applicative, potentially with the assistance of the applicative's pure function. |
<_1Prime> SingletonHList<_1Prime> |
zip(Applicative<Fn1<? super _1,? extends _1Prime>,SingletonHList<?>> appFn)
Given another instance of this applicative over a mapping function, "zip" the two instances together using
whatever application semantics the current applicative supports.
|
equals, hashCode, head, tail
cons, nil, singletonHList, toString, tuple, tuple, tuple, tuple, tuple, tuple, tuple
public <_0> Tuple2<_0,_1> cons(_0 _0)
cons
in class HList.HCons<_1,HList.HNil>
_0
- the new head type_0
- the new head elementpublic <_1Prime> SingletonHList<_1Prime> fmap(Fn1<? super _1,? extends _1Prime> fn)
fmap
in interface Applicative<_1,SingletonHList<?>>
fmap
in interface Functor<_1,SingletonHList<?>>
fmap
in interface Monad<_1,SingletonHList<?>>
fmap
in interface MonadRec<_1,SingletonHList<?>>
fmap
in interface Traversable<_1,SingletonHList<?>>
_1Prime
- the new parameter typefn
- the mapping functionpublic <_1Prime> SingletonHList<_1Prime> pure(_1Prime _1Prime)
b
into this applicative functor.pure
in interface Applicative<_1,SingletonHList<?>>
pure
in interface Monad<_1,SingletonHList<?>>
pure
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the type of the returned applicative's parameter_1Prime
- the valuepublic <_1Prime> SingletonHList<_1Prime> zip(Applicative<Fn1<? super _1,? extends _1Prime>,SingletonHList<?>> appFn)
zip
in interface Applicative<_1,SingletonHList<?>>
zip
in interface Monad<_1,SingletonHList<?>>
zip
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the resulting applicative parameter typeappFn
- the other applicative instancepublic <_1Prime> Lazy<SingletonHList<_1Prime>> lazyZip(Lazy<? extends Applicative<Fn1<? super _1,? extends _1Prime>,SingletonHList<?>>> 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<_1,SingletonHList<?>>
lazyZip
in interface Monad<_1,SingletonHList<?>>
lazyZip
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the resulting applicative parameter typelazyAppFn
- the lazy other applicative instanceMaybe
,
Either
public <_1Prime> SingletonHList<_1Prime> discardL(Applicative<_1Prime,SingletonHList<?>> 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<_1,SingletonHList<?>>
discardL
in interface Monad<_1,SingletonHList<?>>
discardL
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the type of the returned Applicative's parameterappB
- the other Applicativepublic <_1Prime> SingletonHList<_1> discardR(Applicative<_1Prime,SingletonHList<?>> 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<_1,SingletonHList<?>>
discardR
in interface Monad<_1,SingletonHList<?>>
discardR
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the type of appB's parameterappB
- the other Applicativepublic <_1Prime> SingletonHList<_1Prime> flatMap(Fn1<? super _1,? extends Monad<_1Prime,SingletonHList<?>>> f)
flatMap
in interface Monad<_1,SingletonHList<?>>
flatMap
in interface MonadRec<_1,SingletonHList<?>>
_1Prime
- the resulting monad parameter typef
- the dependent computation over Apublic <_1Prime> SingletonHList<_1Prime> trampolineM(Fn1<? super _1,? extends MonadRec<RecursiveResult<_1,_1Prime>,SingletonHList<?>>> 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<_1,SingletonHList<?>>
_1Prime
- 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,App extends Applicative<?,App>,TravB extends Traversable<B,SingletonHList<?>>,AppTrav extends Applicative<TravB,App>> AppTrav traverse(Fn1<? super _1,? extends Applicative<B,App>> fn, Fn1<? super TravB,? extends AppTrav> pure)
fn
to each element of this traversable from left to right, and collapse the results into
a single resulting applicative, potentially with the assistance of the applicative's pure function.traverse
in interface Traversable<_1,SingletonHList<?>>
B
- the resulting element typeApp
- the result applicative typeTravB
- this Traversable instance over BAppTrav
- the full inferred resulting type from the traversalfn
- the function to applypure
- the applicative pure functionpublic <R> R into(Fn1<? super _1,? extends R> fn)
HList.HCons.head()
to fn
and return the result.R
- the return type of the functionfn
- the function to applypublic static Pure<SingletonHList<?>> pureSingletonHList()
Pure
instance for SingletonHList
.Pure
instance