Class Exchange<A,B,S,T>
java.lang.Object
com.jnape.palatable.lambda.functor.builtin.Exchange<A,B,S,T>
- Type Parameters:
A
- the smaller viewed value of anIso
B
- the smaller viewing value of anIso
S
- the larger viewing value of anIso
T
- the larger viewed value of anIso
- All Implemented Interfaces:
Contravariant<S,
,Profunctor<?, T, Exchange<A, B, ?, ?>>> Profunctor<S,
T, Exchange<A, B, ?, ?>>
A profunctor used to extract the isomorphic functions an
Iso
is composed of.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbt()
Extract the mappingB -> T
.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.sa()
Extract the mappingS -> A
.
-
Field Details
-
sa
-
bt
-
-
Constructor Details
-
Exchange
-
-
Method Details
-
sa
Extract the mappingS -> A
.- Returns:
- an
Fn1
<S, A>
-
bt
Extract the mappingB -> T
.- Returns:
- an
Fn1
<B, T>
-
diMap
public <Z,C> Exchange<A,B, diMapZ, C> (Fn1<? super Z, ? extends S> lFn, Fn1<? super T, ? extends C> rFn) Dually map contravariantly over the left parameter and covariantly over the right parameter. This is isomorphic todiMapL(lFn).diMapR(rFn)
.- Specified by:
diMap
in interfaceProfunctor<A,
B, S> - Type Parameters:
Z
- the new left parameter typeC
- 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:
diMapL
in interfaceProfunctor<A,
B, S> - Type Parameters:
Z
- 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:
diMapR
in interfaceProfunctor<A,
B, S> - Type Parameters:
C
- 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:
contraMap
in interfaceContravariant<A,
B> - Specified by:
contraMap
in interfaceProfunctor<A,
B, S> - Type Parameters:
Z
- the new parameter type- Parameters:
fn
- the mapping function- Returns:
- the mapped Contravariant functor instance
-