Class P1<A>
java.lang.Object
fj.P1<A>
- Direct Known Subclasses:
$, P1.Memo, P1.ReferenceMemo
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static class(package private) static final class(package private) static final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription__1()Returns a function that returns the first element of a product.abstract A_1()Access the first element of the product.final <B> P1<B> Performs function application within a P1 (applicative functor pattern).final <B> P1<B> Binds the given function to the value in a product-1 with a final join.final <B,C> P1 <C> Binds the given function to the values in the given P1s with a final join.final <B,C> P1 <C> Binds the given function to the values in the given P1s with a final join.constant()Returns a constant function that always uses this value.Promotes the given function so that it returns its value in a P1.final booleanfinal Af()hardMemo()Returns a P1 that remembers its value.final inthashCode()static <A> P1<A> Joins a P1 of a P1 with a bind operation.Promotes a function of arity-2 to a function on P1s.final <B,C> P1 <C> final <B> P1<B> Map the element of the product.Promote any function to a transformation between P1s.memo()Wrap the memoized value into aWeakReference.Turns an array of P1s into a single P1 of an array.Turns a List of P1s into a single P1 of a List.Turns an optional P1 into a lazy option.Turns a stream of P1s into a single P1 of a stream.A first-class version of the sequence method for lists of P1s.softMemo()Likememo, but the memoized value is wrapped into aSoftReferencefinal StringtoString()traverseEither(F<A, Either<X, B>> f) Traversable instance of P1 for EithertraverseList(F<A, List<B>> f) Traversable instance of P1 for ListtraverseOption(F<A, Option<B>> f) Traversable instance of P1 for OptiontraverseStream(F<A, Stream<B>> f) Traversable instance of P1 for Streamfinal <B,E> Validation <E, P1<B>> traverseValidation(F<A, Validation<E, B>> f) Traversable instance of P1 for ValidationweakMemo()Likememo, but the memoized value is wrapped into aWeakReference
-
Constructor Details
-
P1
public P1()
-
-
Method Details
-
f
-
_1
Access the first element of the product.- Returns:
- The first element of the product.
-
__1
-
map_
-
bind
-
curry
-
apply
-
bind
Binds the given function to the values in the given P1s with a final join.- Parameters:
cb- A given P1 to bind the given function with.f- The function to apply to the values in the given P1s.- Returns:
- A new P1 after performing the map, then final join.
-
bind
-
join
-
liftM2
-
liftM2
-
sequence
-
sequenceList
-
sequence
-
sequence
-
sequence
-
traverseList
-
traverseEither
-
traverseOption
-
traverseValidation
Traversable instance of P1 for Validation- Parameters:
f- The function might produces Validation- Returns:
- An Validation of P1
-
traverseStream
-
map
-
memo
-
hardMemo
-
weakMemo
-
softMemo
-
constant
-
toString
-
equals
-
hashCode
-