Class Market<A,B,S,T>
java.lang.Object
com.jnape.palatable.lambda.functor.builtin.Market<A,B,S,T>
- Type Parameters:
A- the output that might fail to be producedB- the input that guarantees its outputS- the input that might fail to map to its outputT- the guaranteed output
- All Implemented Interfaces:
Applicative<T, Market<A,B, S, ?>>, Cocartesian<S, T, Market<A, B, ?, ?>>, Contravariant<S, Profunctor<?, T, Market<A, B, ?, ?>>>, Functor<T, Market<A, B, S, ?>>, Profunctor<S, T, Market<A, B, ?, ?>>, Monad<T, Market<A, B, S, ?>>, MonadRec<T, Market<A, B, S, ?>>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbt()Extract the mappingB -> T.Choose some typeCor this profunctor's carrier types.Contravariantly mapA <- B.Dually map contravariantly over the left parameter and covariantly over the right parameter.Contravariantly map over the left parameter.Covariantly map over the right parameter.Chain dependent computations that may continue or short-circuit based on previous results.Covariantly transmute this functor's parameter using the given mapping function.pure(U u) Lift the valuebinto this applicative functor.sta()Extract the mappingS ->.Either<T, A>trampolineM(Fn1<? super T, ? extends MonadRec<RecursiveResult<T, U>, Market<A, B, S, ?>>> fn) Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Cocartesian
choose
-
Field Details
-
bt
-
sta
-
-
Constructor Details
-
Market
-
-
Method Details
-
bt
-
sta
-
pure
Lift the valuebinto this applicative functor. -
flatMap
Chain dependent computations that may continue or short-circuit based on previous results. -
trampolineM
public <U> Market<A,B, trampolineMS, U> (Fn1<? super T, ? extends MonadRec<RecursiveResult<T, U>, Market<A, B, S, ?>>> fn) Given some operation yielding aRecursiveResultinside thisMonadRec, internally trampoline the operation until it yields aterminationinstruction.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.
- Specified by:
trampolineMin interfaceMonadRec<A,B> - Type Parameters:
U- the ultimate resulting carrier type- Parameters:
fn- the function to internally trampoline- Returns:
- the trampolined
MonadRec - See Also:
-
zip
Given another instance of this applicative over a mapping function, "zip" the two instances together using whatever application semantics the current applicative supports. -
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:
fmapin interfaceApplicative<A,B> - Specified by:
fmapin interfaceFunctor<A,B> - Specified by:
fmapin interfaceMonad<A,B> - Specified by:
fmapin interfaceMonadRec<A,B> - Type Parameters:
U- the new parameter type- Parameters:
fn- the mapping function- Returns:
- a functor over B (the new parameter type)
-
cocartesian
-
diMap
public <R,U> Market<A,B, diMapR, U> (Fn1<? super R, ? extends S> lFn, Fn1<? super T, ? extends U> rFn) Dually map contravariantly over the left parameter and covariantly over the right parameter. This is isomorphic todiMapL(lFn).diMapR(rFn).- Specified by:
diMapin interfaceCocartesian<A,B, S> - Specified by:
diMapin interfaceProfunctor<A,B, S> - Type Parameters:
R- the new left parameter typeU- the new right parameter type- Parameters:
lFn- the left parameter mapping functionrFn- the right parameter mapping function- Returns:
- a profunctor over Z (the new left parameter type) and C (the new right parameter type)
-
diMapL
Contravariantly map over the left parameter.- Specified by:
diMapLin interfaceCocartesian<A,B, S> - Specified by:
diMapLin interfaceProfunctor<A,B, S> - Type Parameters:
R- the new left parameter type- Parameters:
fn- the mapping function- Returns:
- a profunctor over Z (the new left parameter type) and C (the same right parameter type)
-
diMapR
Covariantly map over the right parameter. For all profunctors that are also functors, it should hold thatdiMapR(f) == fmap(f).- Specified by:
diMapRin interfaceCocartesian<A,B, S> - Specified by:
diMapRin interfaceProfunctor<A,B, S> - Type Parameters:
U- the new right parameter type- Parameters:
fn- the mapping function- Returns:
- a profunctor over A (the same left parameter type) and C (the new right parameter type)
-
contraMap
Contravariantly mapA <- B.- Specified by:
contraMapin interfaceCocartesian<A,B, S> - Specified by:
contraMapin interfaceContravariant<A,B> - Specified by:
contraMapin interfaceProfunctor<A,B, S> - Type Parameters:
R- the new parameter type- Parameters:
fn- the mapping function- Returns:
- the mapped Contravariant functor instance
-
pureMarket
-