Constructor and Description |
---|
P1() |
Modifier and Type | Method and Description |
---|---|
static <A> F<P1<A>,A> |
__1()
Returns a function that returns the first element of a product.
|
abstract A |
_1()
Access the first element of the product.
|
<B> P1<B> |
apply(P1<F<A,B>> cf)
Performs function application within a P1 (applicative functor pattern).
|
<B> P1<B> |
bind(F<A,P1<B>> f)
Binds the given function to the value in a product-1 with a final join.
|
<B,C> P1<C> |
bind(P1<B> cb,
F<A,F<B,C>> f)
Binds the given function to the values in the given P1s with a final join.
|
<B,C> P1<C> |
bind(P1<B> cb,
F2<A,B,C> f)
Binds the given function to the values in the given P1s with a final join.
|
<B> F<B,A> |
constant()
Returns a constant function that always uses this value.
|
static <A,B> F<A,P1<B>> |
curry(F<A,B> f)
Promotes the given function so that it returns its value in a P1.
|
boolean |
equals(java.lang.Object other) |
A |
f() |
static <A,B> F<P1<A>,P1<B>> |
fmap(F<A,B> f)
Deprecated.
As of release 4.5, use
map_(fj.F<A, B>) |
P1<A> |
hardMemo()
Returns a P1 that remembers its value.
|
int |
hashCode() |
static <A> P1<A> |
join(P1<P1<A>> a)
Joins a P1 of a P1 with a bind operation.
|
static <A,B,C> F<P1<A>,F<P1<B>,P1<C>>> |
liftM2(F<A,F<B,C>> f)
Promotes a function of arity-2 to a function on P1s.
|
<B,C> P1<C> |
liftM2(P1<B> pb,
F2<A,B,C> f) |
static <A,B> F<P1<A>,P1<B>> |
map_(F<A,B> f)
Promote any function to a transformation between P1s.
|
<B> P1<B> |
map(F<A,B> f)
Map the element of the product.
|
P1<A> |
memo() |
static <A> P1<A> |
memo(F<Unit,A> f) |
static <A> P1<A> |
memo(F0<A> f) |
static <A> P1<Array<A>> |
sequence(Array<P1<A>> as)
Turns an array of P1s into a single P1 of an array.
|
static <A> P1<List<A>> |
sequence(List<P1<A>> as)
Turns a List of P1s into a single P1 of a List.
|
static <A> P1<Option<A>> |
sequence(Option<P1<A>> o)
Turns an optional P1 into a lazy option.
|
static <A> P1<Stream<A>> |
sequence(Stream<P1<A>> as)
Turns a stream of P1s into a single P1 of a stream.
|
static <A> F<List<P1<A>>,P1<List<A>>> |
sequenceList()
A first-class version of the sequence method for lists of P1s.
|
P1<A> |
softMemo()
Like
memo , but the memoized value is wrapped into a SoftReference |
java.lang.String |
toString() |
<B,X> Either<X,P1<B>> |
traverseEither(F<A,Either<X,B>> f)
Traversable instance of P1 for Either
|
<B> List<P1<B>> |
traverseList(F<A,List<B>> f)
Traversable instance of P1 for List
|
<B> Option<P1<B>> |
traverseOption(F<A,Option<B>> f)
Traversable instance of P1 for Option
|
<B> Stream<P1<B>> |
traverseStream(F<A,Stream<B>> f)
Traversable instance of P1 for Stream
|
<B,E> Validation<E,P1<B>> |
traverseValidation(F<A,Validation<E,B>> f)
Traversable instance of P1 for Validation
|
P1<A> |
weakMemo()
Like
memo , but the memoized value is wrapped into a WeakReference |
public abstract A _1()
public static <A> F<P1<A>,A> __1()
public static <A,B> F<P1<A>,P1<B>> fmap(F<A,B> f)
map_(fj.F<A, B>)
f
- A function to promote to a transformation between P1s.public static <A,B> F<P1<A>,P1<B>> map_(F<A,B> f)
f
- A function to promote to a transformation between P1s.public final <B> P1<B> bind(F<A,P1<B>> f)
f
- A function to apply to the value in a product-1.public static <A,B> F<A,P1<B>> curry(F<A,B> f)
f
- A function to have its result wrapped in a P1.public final <B> P1<B> apply(P1<F<A,B>> cf)
cf
- The P1 function to apply.public final <B,C> P1<C> bind(P1<B> cb, F<A,F<B,C>> f)
cb
- A given P1 to bind the given function with.f
- The function to apply to the values in the given P1s.public final <B,C> P1<C> bind(P1<B> cb, F2<A,B,C> f)
public static <A> P1<A> join(P1<P1<A>> a)
a
- The P1 of a P1 to join.public static <A,B,C> F<P1<A>,F<P1<B>,P1<C>>> liftM2(F<A,F<B,C>> f)
f
- The function to promote.public static <A> P1<List<A>> sequence(List<P1<A>> as)
as
- The list of P1s to transform.public static <A> F<List<P1<A>>,P1<List<A>>> sequenceList()
public static <A> P1<Stream<A>> sequence(Stream<P1<A>> as)
as
- The stream of P1s to transform.public static <A> P1<Option<A>> sequence(Option<P1<A>> o)
public static <A> P1<Array<A>> sequence(Array<P1<A>> as)
as
- The array of P1s to transform.public final <B> List<P1<B>> traverseList(F<A,List<B>> f)
f
- The function that takes A and produces a List (non-deterministic result)public final <B,X> Either<X,P1<B>> traverseEither(F<A,Either<X,B>> f)
f
- The function produces Eitherpublic final <B> Option<P1<B>> traverseOption(F<A,Option<B>> f)
f
- The function that produces Optionpublic final <B,E> Validation<E,P1<B>> traverseValidation(F<A,Validation<E,B>> f)
f
- The function might produces Validationpublic final <B> Stream<P1<B>> traverseStream(F<A,Stream<B>> f)
f
- The function that produces Streampublic final <B> P1<B> map(F<A,B> f)
f
- The function to map with.public final P1<A> hardMemo()
public final <B> F<B,A> constant()
public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object