public class Functions
extends java.lang.Object
Semigroups
Monoids
Predicates
Curry
CurryVariance
CurryConsumer
PartialApplicator
Memoize
FluentFunctions
Fn1
Fn2
Fn3
Fn4| Constructor and Description |
|---|
Functions() |
| Modifier and Type | Method and Description |
|---|---|
static <T,CRE> Fn1<? super T,? extends Higher<CRE,T>> |
arrow(Monad<CRE> monad) |
static <T,W extends WitnessType<W>> |
arrowM(W w)
KleisliM arrow : A function that takes an input value t and embeds it inside a monadic context.
|
static <T,W extends Unit<T>> |
arrowUnit(Unit<?> w)
Use an existing instance of a type that implements Unit to create a KleisliM arrow for that type
|
static <T,R> Fn1<? super T,? extends R> |
constant(R r) |
static <T> Fn1<? super java.lang.Iterable<T>,? extends T> |
head() |
static <T> Fn1<? super T,? extends T> |
identity() |
static <T> Fn1<? super T,? extends Maybe<? extends T>> |
lifted() |
static <T,R> java.util.function.Function<T,R> |
narrow(java.util.function.Function<? super T,? extends R> fn) |
static <T> Fn1<? super java.lang.Iterable<T>,? extends T> |
reduce(Monoid<T> monoid) |
static <T> Fn1<? super java.lang.Iterable<T>,? extends T> |
tail() |
public static final <T,R> Fn1<? super T,? extends R> constant(R r)
public static final <T> Fn1<? super T,? extends T> identity()
public static final <T,W extends WitnessType<W>> Fn1<? super T,? extends AnyM<W,T>> arrowM(W w)
arrow(cyclops.typeclasses.monad.Monad<CRE>)T - Value type to be embedded inside a monadW - The type of the WitnessType (Witness.stream, Witness.Future, Witness.list and so on)w - WitnessType Object: defines the returned monad type (e.g. see Witness.stream for HKT encoding for Streams)public static final <T,W extends Unit<T>> Fn1<? super T,? extends W> arrowUnit(Unit<?> w)
ListX<Integer> myList = ListX.of(1,2,3);
Fn1<? super String, ? extends ListX<String>> arrow = Functions.arrowUnit(myList);
ListX<String> list = arrow.applyHKT("hello world");
T - W - w - public static final <T> Fn1<? super java.lang.Iterable<T>,? extends T> head()
public static final <T> Fn1<? super java.lang.Iterable<T>,? extends T> tail()
public static final <T> Fn1<? super java.lang.Iterable<T>,? extends T> reduce(Monoid<T> monoid)
public static <T,R> java.util.function.Function<T,R> narrow(java.util.function.Function<? super T,? extends R> fn)