Copyright 2008 - 2010 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.

fj
Class Function

java.lang.Object
  extended by fj.Function

public final class Function
extends java.lang.Object

Transformations on functions.


Method Summary
static
<A,B,C> F<F<A,B>,F<F<B,C>,F<A,C>>>
andThen()
          Function composition flipped.
static
<A,B,C> F<A,C>
andThen(F<A,B> g, F<B,C> f)
          Function composition flipped.
static
<A,B> F<F<A,B>,B>
apply(A a)
          Function application with the arguments flipped.
static
<A,B,C> F<C,B>
apply(F<C,F<A,B>> cab, F<C,A> ca)
          Performs function application within a higher-order function (applicative functor pattern).
static
<A,B,C> F<C,B>
bind(F<C,A> ma, F<A,F<C,B>> f)
          Binds the function in the second argument to the function in the first argument.
static
<A,B,C,D> F<D,C>
bind(F<D,A> ca, F<D,B> cb, F<A,F<B,C>> f)
          Binds the given function f to the values of the given functions, with a final join.
static
<A,B,C> F<F<B,C>,F<F<A,B>,F<A,C>>>
compose()
          Function composition.
static
<A,B,C> F<A,C>
compose(F<B,C> f, F<A,B> g)
          Function composition.
static
<A,B,C,D> F<A,F<B,D>>
compose2(F<C,D> f, F<A,F<B,C>> g)
          Function composition.
static
<A,B> F<B,F<A,B>>
constant()
          Returns a function that given an argument, returns a function that ignores its argument.
static
<A,B> F<A,B>
constant(B b)
          Returns a function that ignores its argument to constantly produce the given value.
static
<A,B,C> F<A,F<B,C>>
curry(F2<A,B,C> f)
          Curry a function of arity-2.
static
<A,B,C> F<B,C>
curry(F2<A,B,C> f, A a)
          Curry a function of arity-2.
static
<A,B,C,D> F<A,F<B,F<C,D>>>
curry(F3<A,B,C,D> f)
          Curry a function of arity-3.
static
<A,B,C,D> F<B,F<C,D>>
curry(F3<A,B,C,D> f, A a)
          Curry a function of arity-3.
static
<A,B,C,D> F<C,D>
curry(F3<A,B,C,D> f, A a, B b)
          Curry a function of arity-3.
static
<A,B,C,D,E>
F<A,F<B,F<C,F<D,E>>>>
curry(F4<A,B,C,D,E> f)
          Curry a function of arity-4.
static
<A,B,C,D,E>
F<B,F<C,F<D,E>>>
curry(F4<A,B,C,D,E> f, A a)
          Curry a function of arity-4.
static
<A,B,C,D,E>
F<C,F<D,E>>
curry(F4<A,B,C,D,E> f, A a, B b)
          Curry a function of arity-4.
static
<A,B,C,D,E>
F<D,E>
curry(F4<A,B,C,D,E> f, A a, B b, C c)
          Curry a function of arity-4.
static
<A,B,C,D,E,F$>
F<A,F<B,F<C,F<D,F<E,F$>>>>>
curry(F5<A,B,C,D,E,F$> f)
          Curry a function of arity-5.
static
<A,B,C,D,E,F$>
F<B,F<C,F<D,F<E,F$>>>>
curry(F5<A,B,C,D,E,F$> f, A a)
          Curry a function of arity-5.
static
<A,B,C,D,E,F$>
F<C,F<D,F<E,F$>>>
curry(F5<A,B,C,D,E,F$> f, A a, B b)
          Curry a function of arity-5.
static
<A,B,C,D,E,F$>
F<D,F<E,F$>>
curry(F5<A,B,C,D,E,F$> f, A a, B b, C c)
          Curry a function of arity-5.
static
<A,B,C,D,E,F$>
F<E,F$>
curry(F5<A,B,C,D,E,F$> f, A a, B b, C c, D d)
          Curry a function of arity-5.
static
<A,B,C,D,E,F$,G>
F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>>
curry(F6<A,B,C,D,E,F$,G> f)
          Curry a function of arity-6.
static
<A,B,C,D,E,F$,G,H>
F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>>
curry(F7<A,B,C,D,E,F$,G,H> f)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>
curry(F7<A,B,C,D,E,F$,G,H> f, A a)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<C,F<D,F<E,F<F$,F<G,H>>>>>
curry(F7<A,B,C,D,E,F$,G,H> f, A a, B b)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<D,F<E,F<F$,F<G,H>>>>
curry(F7<A,B,C,D,E,F$,G,H> f, A a, B b, C c)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<E,F<F$,F<G,H>>>
curry(F7<A,B,C,D,E,F$,G,H> f, A a, B b, C c, D d)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<F$,F<G,H>>
curry(F7<A,B,C,D,E,F$,G,H> f, A a, B b, C c, D d, E e)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F<G,H>
curry(F7<A,B,C,D,E,F$,G,H> f, A a, B b, C c, D d, E e, F$ f$)
          Curry a function of arity-7.
static
<A,B,C,D,E,F$,G,H,I>
F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<D,F<E,F<F$,F<G,F<H,I>>>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b, C c)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<E,F<F$,F<G,F<H,I>>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b, C c, D d)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<F$,F<G,F<H,I>>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b, C c, D d, E e)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<G,F<H,I>>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b, C c, D d, E e, F$ f$)
          Curry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F<H,I>
curry(F8<A,B,C,D,E,F$,G,H,I> f, A a, B b, C c, D d, E e, F$ f$, G g)
          Curry a function of arity-7.
static
<A,B,C> F<F<A,F<B,C>>,F<B,F<A,C>>>
flip()
          Function argument flipping.
static
<A,B,C> F<B,F<A,C>>
flip(F<A,F<B,C>> f)
          Function argument flipping.
static
<A,B,C> F2<B,A,C>
flip(F2<A,B,C> f)
          Function argument flipping.
static
<A,B,C> F<F2<A,B,C>,F2<B,A,C>>
flip2()
          Function argument flipping.
static
<A> F<A,A>
identity()
          The identity transformation.
static
<A,B> F<B,A>
join(F<B,F<B,A>> f)
          Joins two arguments of a function of arity-2 into one argument, yielding a function of arity-1.
static
<A,B,C,D> F<F<D,A>,F<F<D,B>,F<D,C>>>
lift(F<A,F<B,C>> f)
          Promotes a function of arity-2 to a higher-order function.
static
<A,B> F<A,Option<B>>
nullable(F<A,B> f)
          Return a function that inspects the argument of the given function for a null value and if so, does not apply the value, instead returning an empty optional value.
static
<A,B,C> F<B,F<B,C>>
on(F<A,F<A,C>> a, F<B,A> f)
          Applies a given function over the arguments of another function of arity-2.
static
<A,B,C> F<A,C>
partialApply2(F<A,F<B,C>> f, B b)
          Partial application of the second argument to the supplied function to get a function of type A -> C.
static
<A,B,C,D> F<A,F<B,D>>
partialApply3(F<A,F<B,F<C,D>>> f, C c)
          Partial application of the third argument to the supplied function to get a function of type A -> B -> D.
static
<A,B,C,D,E>
F<A,F<B,F<C,E>>>
partialApply4(F<A,F<B,F<C,F<D,E>>>> f, D d)
          Partial application of the fourth argument to the supplied function to get a function of type A -> B -> C -> E.
static
<A,B,C,D,E,F$>
F<A,F<B,F<C,F<D,F$>>>>
partialApply5(F<A,F<B,F<C,F<D,F<E,F$>>>>> f, E e)
          Partial application of the fifth argument to the supplied function to get a function of type A -> B -> C -> D -> F$.
static
<A,B,C,D,E,F$,G>
F<A,F<B,F<C,F<D,F<E,G>>>>>
partialApply6(F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f, F$ f$)
          Partial application of the sixth argument to the supplied function to get a function of type A -> B -> C -> D -> E -> G.
static
<A,B,C,D,E,F$,G,H>
F<A,F<B,F<C,F<D,F<E,F<F$,H>>>>>>
partialApply7(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f, G g)
          Partial application of the seventh argument to the supplied function to get a function of type A -> B -> C -> D -> E -> F$ -> H.
static
<A,B,C,D,E,F$,G,H,I>
F<A,F<B,F<C,F<D,F<E,F<F$,F<G,I>>>>>>>
partialApply8(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f, H h)
          Partial application of the eigth argument to the supplied function to get a function of type A -> B -> C -> D -> E -> F$ -> G -> I.
static
<A,B,C> F<F<A,F<B,C>>,F2<A,B,C>>
uncurryF2()
          Uncurry a function of arity-2.
static
<A,B,C> F2<A,B,C>
uncurryF2(F<A,F<B,C>> f)
          Uncurry a function of arity-2.
static
<A,B,C,D> F<F<A,F<B,F<C,D>>>,F3<A,B,C,D>>
uncurryF3()
          Uncurry a function of arity-3.
static
<A,B,C,D> F3<A,B,C,D>
uncurryF3(F<A,F<B,F<C,D>>> f)
          Uncurry a function of arity-3.
static
<A,B,C,D,E>
F<F<A,F<B,F<C,F<D,E>>>>,F4<A,B,C,D,E>>
uncurryF4()
          Uncurry a function of arity-4.
static
<A,B,C,D,E>
F4<A,B,C,D,E>
uncurryF4(F<A,F<B,F<C,F<D,E>>>> f)
          Uncurry a function of arity-4.
static
<A,B,C,D,E,F$>
F<F<A,F<B,F<C,F<D,F<E,F$>>>>>,F5<A,B,C,D,E,F$>>
uncurryF5()
          Uncurry a function of arity-5.
static
<A,B,C,D,E,F$>
F5<A,B,C,D,E,F$>
uncurryF5(F<A,F<B,F<C,F<D,F<E,F$>>>>> f)
          Uncurry a function of arity-6.
static
<A,B,C,D,E,F$,G>
F<F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>>,F6<A,B,C,D,E,F$,G>>
uncurryF6()
          Uncurry a function of arity-6.
static
<A,B,C,D,E,F$,G>
F6<A,B,C,D,E,F$,G>
uncurryF6(F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f)
          Uncurry a function of arity-6.
static
<A,B,C,D,E,F$,G,H>
F<F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>>,F7<A,B,C,D,E,F$,G,H>>
uncurryF7()
          Uncurry a function of arity-7.
static
<A,B,C,D,E,F$,G,H>
F7<A,B,C,D,E,F$,G,H>
uncurryF7(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f)
          Uncurry a function of arity-7.
static
<A,B,C,D,E,F$,G,H,I>
F<F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>>,F8<A,B,C,D,E,F$,G,H,I>>
uncurryF8()
          Uncurry a function of arity-8.
static
<A,B,C,D,E,F$,G,H,I>
F8<A,B,C,D,E,F$,G,H,I>
uncurryF8(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f)
          Uncurry a function of arity-8.
static
<C,A extends C,B,D extends B>
F<F<C,D>,F<A,B>>
vary()
          Simultaneously covaries and contravaries a function.
static
<A,B> F<A,B>
vary(F<? super A,? extends B> f)
          Simultaneously covaries and contravaries a function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public static <A,B> F<F<A,B>,B> apply(A a)
Function application with the arguments flipped.

Parameters:
a - The value to apply the function to.
Returns:
A function that is partially-applied to the given value.

compose

public static <A,B,C> F<F<B,C>,F<F<A,B>,F<A,C>>> compose()
Function composition.

Returns:
A function that composes two functions to produce a new function.

compose

public static <A,B,C> F<A,C> compose(F<B,C> f,
                                     F<A,B> g)
Function composition.

Parameters:
f - A function to compose with another.
g - A function to compose with another.
Returns:
A function that is the composition of the given arguments.

compose2

public static <A,B,C,D> F<A,F<B,D>> compose2(F<C,D> f,
                                             F<A,F<B,C>> g)
Function composition.

Parameters:
f - A function to compose with another.
g - A function to compose with another.
Returns:
A function that is the composition of the given arguments.

andThen

public static <A,B,C> F<F<A,B>,F<F<B,C>,F<A,C>>> andThen()
Function composition flipped.

Returns:
A function that composes two functions to produce a new function.

andThen

public static <A,B,C> F<A,C> andThen(F<A,B> g,
                                     F<B,C> f)
Function composition flipped.

Parameters:
g - A function to compose with another.
f - A function to compose with another.
Returns:
A function that is the composition of the given arguments.

identity

public static <A> F<A,A> identity()
The identity transformation.

Returns:
The identity transformation.

constant

public static <A,B> F<B,F<A,B>> constant()
Returns a function that given an argument, returns a function that ignores its argument.

Returns:
A function that given an argument, returns a function that ignores its argument.

constant

public static <A,B> F<A,B> constant(B b)
Returns a function that ignores its argument to constantly produce the given value.

Parameters:
b - The value to return when the returned function is applied.
Returns:
A function that ignores its argument to constantly produce the given value.

vary

public static <A,B> F<A,B> vary(F<? super A,? extends B> f)
Simultaneously covaries and contravaries a function.

Parameters:
f - The function to vary.
Returns:
A co- and contravariant function that invokes f on its argument.

vary

public static <C,A extends C,B,D extends B> F<F<C,D>,F<A,B>> vary()
Simultaneously covaries and contravaries a function.

Returns:
A function that varies and covaries a function.

flip

public static <A,B,C> F<F<A,F<B,C>>,F<B,F<A,C>>> flip()
Function argument flipping.

Returns:
A function that takes a function and flips its arguments.

flip

public static <A,B,C> F<B,F<A,C>> flip(F<A,F<B,C>> f)
Function argument flipping.

Parameters:
f - The function to flip.
Returns:
The given function flipped.

flip

public static <A,B,C> F2<B,A,C> flip(F2<A,B,C> f)
Function argument flipping.

Parameters:
f - The function to flip.
Returns:
The given function flipped.

flip2

public static <A,B,C> F<F2<A,B,C>,F2<B,A,C>> flip2()
Function argument flipping.

Returns:
A function that flips the arguments of a given function.

nullable

public static <A,B> F<A,Option<B>> nullable(F<A,B> f)
Return a function that inspects the argument of the given function for a null value and if so, does not apply the value, instead returning an empty optional value.

Parameters:
f - The function to check for a null argument.
Returns:
A function that inspects the argument of the given function for a null value and if so, does not apply the value, instead returning an empty optional value.

curry

public static <A,B,C> F<A,F<B,C>> curry(F2<A,B,C> f)
Curry a function of arity-2.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C> F<B,C> curry(F2<A,B,C> f,
                                   A a)
Curry a function of arity-2.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF2

public static <A,B,C> F<F<A,F<B,C>>,F2<A,B,C>> uncurryF2()
Uncurry a function of arity-2.

Returns:
An uncurried function.

uncurryF2

public static <A,B,C> F2<A,B,C> uncurryF2(F<A,F<B,C>> f)
Uncurry a function of arity-2.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D> F<A,F<B,F<C,D>>> curry(F3<A,B,C,D> f)
Curry a function of arity-3.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D> F<B,F<C,D>> curry(F3<A,B,C,D> f,
                                          A a)
Curry a function of arity-3.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D> F<C,D> curry(F3<A,B,C,D> f,
                                     A a,
                                     B b)
Curry a function of arity-3.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF3

public static <A,B,C,D> F<F<A,F<B,F<C,D>>>,F3<A,B,C,D>> uncurryF3()
Uncurry a function of arity-3.

Returns:
An uncurried function.

uncurryF3

public static <A,B,C,D> F3<A,B,C,D> uncurryF3(F<A,F<B,F<C,D>>> f)
Uncurry a function of arity-3.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D,E> F<A,F<B,F<C,F<D,E>>>> curry(F4<A,B,C,D,E> f)
Curry a function of arity-4.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E> F<B,F<C,F<D,E>>> curry(F4<A,B,C,D,E> f,
                                                 A a)
Curry a function of arity-4.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E> F<C,F<D,E>> curry(F4<A,B,C,D,E> f,
                                            A a,
                                            B b)
Curry a function of arity-4.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E> F<D,E> curry(F4<A,B,C,D,E> f,
                                       A a,
                                       B b,
                                       C c)
Curry a function of arity-4.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF4

public static <A,B,C,D,E> F<F<A,F<B,F<C,F<D,E>>>>,F4<A,B,C,D,E>> uncurryF4()
Uncurry a function of arity-4.

Returns:
An uncurried function.

uncurryF4

public static <A,B,C,D,E> F4<A,B,C,D,E> uncurryF4(F<A,F<B,F<C,F<D,E>>>> f)
Uncurry a function of arity-4.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D,E,F$> F<A,F<B,F<C,F<D,F<E,F$>>>>> curry(F5<A,B,C,D,E,F$> f)
Curry a function of arity-5.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$> F<B,F<C,F<D,F<E,F$>>>> curry(F5<A,B,C,D,E,F$> f,
                                                          A a)
Curry a function of arity-5.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$> F<C,F<D,F<E,F$>>> curry(F5<A,B,C,D,E,F$> f,
                                                     A a,
                                                     B b)
Curry a function of arity-5.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$> F<D,F<E,F$>> curry(F5<A,B,C,D,E,F$> f,
                                                A a,
                                                B b,
                                                C c)
Curry a function of arity-5.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$> F<E,F$> curry(F5<A,B,C,D,E,F$> f,
                                           A a,
                                           B b,
                                           C c,
                                           D d)
Curry a function of arity-5.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF5

public static <A,B,C,D,E,F$> F<F<A,F<B,F<C,F<D,F<E,F$>>>>>,F5<A,B,C,D,E,F$>> uncurryF5()
Uncurry a function of arity-5.

Returns:
An uncurried function.

uncurryF5

public static <A,B,C,D,E,F$> F5<A,B,C,D,E,F$> uncurryF5(F<A,F<B,F<C,F<D,F<E,F$>>>>> f)
Uncurry a function of arity-6.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D,E,F$,G> F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> curry(F6<A,B,C,D,E,F$,G> f)
Curry a function of arity-6.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

uncurryF6

public static <A,B,C,D,E,F$,G> F<F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>>,F6<A,B,C,D,E,F$,G>> uncurryF6()
Uncurry a function of arity-6.

Returns:
An uncurried function.

uncurryF6

public static <A,B,C,D,E,F$,G> F6<A,B,C,D,E,F$,G> uncurryF6(F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f)
Uncurry a function of arity-6.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D,E,F$,G,H> F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> curry(F7<A,B,C,D,E,F$,G,H> f)
Curry a function of arity-7.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>> curry(F7<A,B,C,D,E,F$,G,H> f,
                                                                        A a)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<C,F<D,F<E,F<F$,F<G,H>>>>> curry(F7<A,B,C,D,E,F$,G,H> f,
                                                                   A a,
                                                                   B b)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<D,F<E,F<F$,F<G,H>>>> curry(F7<A,B,C,D,E,F$,G,H> f,
                                                              A a,
                                                              B b,
                                                              C c)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<E,F<F$,F<G,H>>> curry(F7<A,B,C,D,E,F$,G,H> f,
                                                         A a,
                                                         B b,
                                                         C c,
                                                         D d)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<F$,F<G,H>> curry(F7<A,B,C,D,E,F$,G,H> f,
                                                    A a,
                                                    B b,
                                                    C c,
                                                    D d,
                                                    E e)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
e - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H> F<G,H> curry(F7<A,B,C,D,E,F$,G,H> f,
                                              A a,
                                              B b,
                                              C c,
                                              D d,
                                              E e,
                                              F$ f$)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
e - An argument to the curried function.
f$ - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF7

public static <A,B,C,D,E,F$,G,H> F<F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>>,F7<A,B,C,D,E,F$,G,H>> uncurryF7()
Uncurry a function of arity-7.

Returns:
An uncurried function.

uncurryF7

public static <A,B,C,D,E,F$,G,H> F7<A,B,C,D,E,F$,G,H> uncurryF7(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f)
Uncurry a function of arity-7.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> curry(F8<A,B,C,D,E,F$,G,H,I> f)
Curry a function of arity-8.

Parameters:
f - The function to curry.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                                               A a)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                                          A a,
                                                                          B b)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<D,F<E,F<F$,F<G,F<H,I>>>>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                                     A a,
                                                                     B b,
                                                                     C c)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<E,F<F$,F<G,F<H,I>>>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                                A a,
                                                                B b,
                                                                C c,
                                                                D d)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<F$,F<G,F<H,I>>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                           A a,
                                                           B b,
                                                           C c,
                                                           D d,
                                                           E e)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
e - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<G,F<H,I>> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                     A a,
                                                     B b,
                                                     C c,
                                                     D d,
                                                     E e,
                                                     F$ f$)
Curry a function of arity-8.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
e - An argument to the curried function.
f$ - An argument to the curried function.
Returns:
A curried form of the given function.

curry

public static <A,B,C,D,E,F$,G,H,I> F<H,I> curry(F8<A,B,C,D,E,F$,G,H,I> f,
                                                A a,
                                                B b,
                                                C c,
                                                D d,
                                                E e,
                                                F$ f$,
                                                G g)
Curry a function of arity-7.

Parameters:
f - The function to curry.
a - An argument to the curried function.
b - An argument to the curried function.
c - An argument to the curried function.
d - An argument to the curried function.
e - An argument to the curried function.
f$ - An argument to the curried function.
g - An argument to the curried function.
Returns:
A curried form of the given function.

uncurryF8

public static <A,B,C,D,E,F$,G,H,I> F<F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>>,F8<A,B,C,D,E,F$,G,H,I>> uncurryF8()
Uncurry a function of arity-8.

Returns:
An uncurried function.

uncurryF8

public static <A,B,C,D,E,F$,G,H,I> F8<A,B,C,D,E,F$,G,H,I> uncurryF8(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f)
Uncurry a function of arity-8.

Parameters:
f - The function to uncurry.
Returns:
An uncurried function.

bind

public static <A,B,C> F<C,B> bind(F<C,A> ma,
                                  F<A,F<C,B>> f)
Binds the function in the second argument to the function in the first argument.

Parameters:
ma - A function whose argument type is the same as the argument type of the return value.
f - A function whose argument type is the same as the return type of ma, and yields the return value.
Returns:
A function that chains the given functions together such that the result of applying ma to the argument is given to f, yielding a function that is applied to the argument again.

apply

public static <A,B,C> F<C,B> apply(F<C,F<A,B>> cab,
                                   F<C,A> ca)
Performs function application within a higher-order function (applicative functor pattern).

Parameters:
cab - The higher-order function to apply a function to.
ca - A function to apply within a higher-order function.
Returns:
A new function after applying the given higher-order function to the given function.

bind

public static <A,B,C,D> F<D,C> bind(F<D,A> ca,
                                    F<D,B> cb,
                                    F<A,F<B,C>> f)
Binds the given function f to the values of the given functions, with a final join.

Parameters:
ca - A function to bind f function to.
cb - A function to bind f function to.
f - The bound function to be composed with ca and then applied with cb
Returns:
A new function after performing the composition, then application.

on

public static <A,B,C> F<B,F<B,C>> on(F<A,F<A,C>> a,
                                     F<B,A> f)
Applies a given function over the arguments of another function of arity-2.

Parameters:
a - The function whose arguments to apply another function over.
f - The function to apply over the arguments of another function.
Returns:
A function whose arguments are fed through function f, before being passed to function a.

lift

public static <A,B,C,D> F<F<D,A>,F<F<D,B>,F<D,C>>> lift(F<A,F<B,C>> f)
Promotes a function of arity-2 to a higher-order function.

Parameters:
f - The function to promote.
Returns:
A function of arity-2 promoted to compose with two functions.

join

public static <A,B> F<B,A> join(F<B,F<B,A>> f)
Joins two arguments of a function of arity-2 into one argument, yielding a function of arity-1.

Parameters:
f - A function whose arguments to join.
Returns:
A function of arity-1 whose argument is substituted for both parameters of f.

partialApply2

public static <A,B,C> F<A,C> partialApply2(F<A,F<B,C>> f,
                                           B b)
Partial application of the second argument to the supplied function to get a function of type A -> C. Same as flip(f).f(b).

Parameters:
f - The function to partially apply.
b - The value to apply to the function.
Returns:
A new function based on f with its second argument applied.

partialApply3

public static <A,B,C,D> F<A,F<B,D>> partialApply3(F<A,F<B,F<C,D>>> f,
                                                  C c)
Partial application of the third argument to the supplied function to get a function of type A -> B -> D.

Parameters:
f - The function to partially apply.
c - The value to apply to the function.
Returns:
A new function based on f with its third argument applied.

partialApply4

public static <A,B,C,D,E> F<A,F<B,F<C,E>>> partialApply4(F<A,F<B,F<C,F<D,E>>>> f,
                                                         D d)
Partial application of the fourth argument to the supplied function to get a function of type A -> B -> C -> E.

Parameters:
f - The function to partially apply.
d - The value to apply to the function.
Returns:
A new function based on f with its fourth argument applied.

partialApply5

public static <A,B,C,D,E,F$> F<A,F<B,F<C,F<D,F$>>>> partialApply5(F<A,F<B,F<C,F<D,F<E,F$>>>>> f,
                                                                  E e)
Partial application of the fifth argument to the supplied function to get a function of type A -> B -> C -> D -> F$.

Parameters:
f - The function to partially apply.
e - The value to apply to the function.
Returns:
A new function based on f with its fifth argument applied.

partialApply6

public static <A,B,C,D,E,F$,G> F<A,F<B,F<C,F<D,F<E,G>>>>> partialApply6(F<A,F<B,F<C,F<D,F<E,F<F$,G>>>>>> f,
                                                                        F$ f$)
Partial application of the sixth argument to the supplied function to get a function of type A -> B -> C -> D -> E -> G.

Parameters:
f - The function to partially apply.
f$ - The value to apply to the function.
Returns:
A new function based on f with its sixth argument applied.

partialApply7

public static <A,B,C,D,E,F$,G,H> F<A,F<B,F<C,F<D,F<E,F<F$,H>>>>>> partialApply7(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,H>>>>>>> f,
                                                                                G g)
Partial application of the seventh argument to the supplied function to get a function of type A -> B -> C -> D -> E -> F$ -> H.

Parameters:
f - The function to partially apply.
g - The value to apply to the function.
Returns:
A new function based on f with its seventh argument applied.

partialApply8

public static <A,B,C,D,E,F$,G,H,I> F<A,F<B,F<C,F<D,F<E,F<F$,F<G,I>>>>>>> partialApply8(F<A,F<B,F<C,F<D,F<E,F<F$,F<G,F<H,I>>>>>>>> f,
                                                                                       H h)
Partial application of the eigth argument to the supplied function to get a function of type A -> B -> C -> D -> E -> F$ -> G -> I.

Parameters:
f - The function to partially apply.
h - The value to apply to the function.
Returns:
A new function based on f with its eigth argument applied.

Copyright 2008 - 2010 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg

This software is released under an open source BSD licence.