public static enum FunctionType.Instance extends Enum<FunctionType.Instance> implements TraversalP (_) -> _, MonoidProfunctor<(_) -> _,FunctionType.Instance.Mu>, Mapping<(_) -> _,FunctionType.Instance.Mu>, Monoidal<(_) -> _,FunctionType.Instance.Mu>
Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
<A,B,C,D> ((A) -> B) -> (C) -> D |
dimap((C) -> A g,
(B) -> D h)
Takes a function from the output type
C to the input type A and a function from the input
type B to the output type D , and returns a function from a container of A, B to
a container of C, D . |
(Void) -> Void |
empty() |
<A,B,C> ((A,C)) -> (B,C) |
first((A) -> B input)
Converts the given transformation into one that transforms the first type of a
Pair . |
<A,B,C> ((A|C)) -> (B|C) |
left((A) -> B input)
Converts the given transformation into one that transforms the left type of an
Either . |
<A,B,F extends K1> |
mapping(Functor F functor,
(A) -> B input) |
<A,B,C,D> ((A,C)) -> (B,D) |
par((A) -> B first,
by-name (C) -> D second) |
<A,B> (A) -> B |
plus(Procompose<(A) -> ?C,(?C) -> B> input) |
<A,B,C> ((C|A)) -> (C|B) |
right((A) -> B input)
Converts the given transformation into one that transforms the right type of an
Either . |
<A,B,C> ((C,A)) -> (C,B) |
second((A) -> B input)
Converts the given transformation into one that transforms the second type of a
Pair . |
static FunctionType.Instance |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static FunctionType.Instance[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
<S,T,A,B> (S) -> T |
wander(Wander<S::A,T::B> wander,
(A) -> B input)
Takes an operation defined by
Wander and a transformation between field types, and produces a
transformation between object types. |
<A,B> (A) -> B |
zero((A) -> B func) |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
compose
toFP3, traverse
toFP
dimap, dimap, lmap, rmap
public static final FunctionType.Instance INSTANCE
public static FunctionType.Instance[] values()
for (FunctionType.Instance c : FunctionType.Instance.values()) System.out.println(c);
public static FunctionType.Instance valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic <A,B,C,D> ((A) -> B) -> (C) -> D dimap((C) -> A g, (B) -> D h)
Profunctor
C
to the input type A
and a function from the input
type B
to the output type D
, and returns a function from a container of A, B
to
a container of C, D
.
A straightforward example of an implementation of dimap
is the method Function.andThen(Function)
.
For functions, the expression
dimap(g, h).apply(f)
is equivalent to
g.andThen(f).andThen(h)
dimap
in interface Profunctor (_) -> _
A
- The first input type.B
- The second input type.C
- The first output type.D
- The second output type.g
- A function from output to input.h
- A function from input to output.Profunctor.dimap(App2, Function, Function)
public <A,B,C> ((A,C)) -> (B,C) first((A) -> B input)
Cartesian
Pair
. The second type
is not transformed - any values of that type are passed through the returned transformation unchanged.first
in interface Cartesian (_) -> _
first
in interface TraversalP (_) -> _
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.public <A,B,C> ((C,A)) -> (C,B) second((A) -> B input)
Cartesian
Pair
. The first type
is not transformed - any values of that type are passed through the returned transformation unchanged.public <S,T,A,B> (S) -> T wander(Wander<S::A,T::B> wander, (A) -> B input)
TraversalP
Wander
and a transformation between field types, and produces a
transformation between object types.
The returned transformation should accept an object S
, extract a field A
, apply the given input,
and return the resulting B
via an output object T
, all in the context of some effectful computation
defined by the wander
.
wander
in interface TraversalP (_) -> _
S
- The input object type.T
- The output object type.A
- The input field type.B
- The output field type.wander
- A mapping from effectful functions on the field types to effectful functions on the object types.input
- A (non-effectful) transformation between object types.Wander
,
Traversable
public <A,B,C> ((A|C)) -> (B|C) left((A) -> B input)
Cocartesian
Either
. The right
type of the Either
is left unchanged by the returned transformation.left
in interface Cocartesian (_) -> _
left
in interface TraversalP (_) -> _
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.Either
.public <A,B,C> ((C|A)) -> (C|B) right((A) -> B input)
Cocartesian
Either
. The left
type of the Either
is left unchanged by the returned transformation.right
in interface Cocartesian (_) -> _
A
- The input type.B
- The output type.C
- A "pass-through" type that is not transformed.input
- The transformation.Either
.public <A,B,C,D> ((A,C)) -> (B,D) par((A) -> B first, by-name (C) -> D second)
par
in interface Monoidal<(_) -> _,FunctionType.Instance.Mu>
public (Void) -> Void empty()
empty
in interface Monoidal<(_) -> _,FunctionType.Instance.Mu>
public <A,B> (A) -> B zero((A) -> B func)
zero
in interface MonoidProfunctor<(_) -> _,FunctionType.Instance.Mu>
public <A,B> (A) -> B plus(Procompose<(A) -> ?C,(?C) -> B> input)
plus
in interface MonoidProfunctor<(_) -> _,FunctionType.Instance.Mu>