Class Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,A>
java.lang.Object
com.jnape.palatable.lambda.functor.builtin.Compose<F,G,A>
- Type Parameters:
F
- The outer applicativeG
- The inner applicativeA
- The carrier type
- All Implemented Interfaces:
Applicative<A,
,Compose<F, G, ?>> Functor<A,
Compose<F, G, ?>>
public final class Compose<F extends Applicative<?,F>,G extends Applicative<?,G>,A>
extends Object
implements Applicative<A,Compose<F,G,?>>
A functor representing the type-level composition of two
Applicative
functors; useful for preserving nested
type-level transformations during traversal of a Traversable
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondiscardL
(Applicative<B, Compose<F, G, ?>> appB) Sequence both thisApplicative
andappB
, discarding thisApplicative's
result and returningappB
.discardR
(Applicative<B, Compose<F, G, ?>> appB) Sequence both thisApplicative
andappB
, discardingappB's
result and returning thisApplicative
.boolean
Covariantly transmute this functor's parameter using the given mapping function.<GA extends Applicative<A,
G>, FGA extends Applicative<GA, F>>
FGAint
hashCode()
Given alazy
instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.pure
(B b) Lift the valueb
into this applicative functor.static <F extends Applicative<?,
F>, G extends Applicative<?, G>>
Pure<Compose<F, G, ?>> pureCompose
(Pure<F> pureF, Pure<G> pureG) toString()
Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.
-
Field Details
-
fga
private final Applicative<? extends Applicative<A,G extends Applicative<?, fgaG>>, F extends Applicative<?, F>>
-
-
Constructor Details
-
Compose
-
-
Method Details
-
getCompose
-
fmap
Covariantly transmute this functor's parameter using the given mapping function. Generally this method is specialized to return an instance of the class implementing Functor.- Specified by:
fmap
in interfaceApplicative<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Specified by:
fmap
in interfaceFunctor<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the new parameter type- Parameters:
fn
- the mapping function- Returns:
- a functor over B (the new parameter type)
-
pure
Lift the valueb
into this applicative functor.- Specified by:
pure
in interfaceApplicative<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the type of the returned applicative's parameter- Parameters:
b
- the value- Returns:
- an instance of this applicative over b
-
zip
Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.- Specified by:
zip
in interfaceApplicative<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the resulting applicative parameter type- Parameters:
appFn
- the other applicative instance- Returns:
- the mapped applicative
-
lazyZip
public <B> Lazy<Compose<F,G, lazyZipB>> (Lazy<? extends Applicative<Fn1<? super A, ? extends B>, Compose<F, G, ?>>> lazyAppFn) Given alazy
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.- Specified by:
lazyZip
in interfaceApplicative<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the resulting applicative parameter type- Parameters:
lazyAppFn
- the lazy other applicative instance- Returns:
- the mapped applicative
- See Also:
-
discardL
Sequence both thisApplicative
andappB
, discarding thisApplicative's
result and returningappB
. This is generally useful for sequentially performing side-effects.- Specified by:
discardL
in interfaceApplicative<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the type of the returned Applicative's parameter- Parameters:
appB
- the other Applicative- Returns:
- appB
-
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<F extends Applicative<?,
F>, G extends Applicative<?, G>> - Type Parameters:
B
- the type of appB's parameter- Parameters:
appB
- the other Applicative- Returns:
- this Applicative
-
equals
-
hashCode
public int hashCode() -
toString
-
pureCompose
public static <F extends Applicative<?,F>, Pure<Compose<F,G extends Applicative<?, G>> G, pureCompose?>> (Pure<F> pureF, Pure<G> pureG) - Type Parameters:
F
- the outerApplicative
typeG
- the innerApplicative
type- Parameters:
pureF
- thePure
constructor for the outerApplicative
pureG
- thePure
constructor for the innerApplicative
- Returns:
- the
Pure
instance
-