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 F2<A,B,C>

java.lang.Object
  extended by fj.F2<A,B,C>

public abstract class F2<A,B,C>
extends java.lang.Object

A transformation function of arity-2 from A and B to C. This type can be represented using the Java 7 closure syntax.


Constructor Summary
F2()
           
 
Method Summary
 F2<Array<A>,Array<B>,Array<C>> arrayM()
          Promotes this function to a function on Arrays.
 F<A,F<B,C>> curry()
          Curries this wrapped function to a wrapped function of arity-1 that returns another wrapped function.
 F<B,C> f(A a)
          Partial application.
abstract  C f(A a, B b)
          Transform A and B to C.
 F2<B,A,C> flip()
          Flips the arguments of this function.
 F2<java.lang.Iterable<A>,java.lang.Iterable<B>,IterableW<C>> iterableM()
          Promotes this function to a function on Iterables.
 F2<List<A>,List<B>,List<C>> listM()
          Promotes this function to a function on Lists.
 F2<NonEmptyList<A>,NonEmptyList<B>,NonEmptyList<C>> nelM()
          Promotes this function to a function on non-empty lists.
 F2<Option<A>,Option<B>,Option<C>> optionM()
          Promotes this function to a function on Options.
 F2<Promise<A>,Promise<B>,Promise<C>> promiseM()
          Promotes this function to a function on Promises.
 F2<Set<A>,Set<B>,Set<C>> setM(Ord<C> o)
          Promotes this function to a function on Sets.
 F2<Stream<A>,Stream<B>,Stream<C>> streamM()
          Promotes this function to a function on Streams.
 F2<Tree<A>,Tree<B>,Tree<C>> treeM()
          Promotes this function to a function on Trees.
 F<P2<A,B>,C> tuple()
          Uncurries this function to a function on tuples.
 F2<Array<A>,Array<B>,Array<C>> zipArrayM()
          Promotes this function to zip two arrays, applying the function lock-step over both Arrays.
 F2<java.lang.Iterable<A>,java.lang.Iterable<B>,java.lang.Iterable<C>> zipIterableM()
          Promotes this function to zip two iterables, applying the function lock-step over both iterables.
 F2<List<A>,List<B>,List<C>> zipListM()
          Promotes this function to zip two lists, applying the function lock-step over both lists.
 F2<NonEmptyList<A>,NonEmptyList<B>,NonEmptyList<C>> zipNelM()
          Promotes this function to zip two non-empty lists, applying the function lock-step over both lists.
 F2<Set<A>,Set<B>,Set<C>> zipSetM(Ord<C> o)
          Promotes this function to zip two sets, applying the function lock-step over both sets.
 F2<Stream<A>,Stream<B>,Stream<C>> zipStreamM()
          Promotes this function to zip two streams, applying the function lock-step over both streams.
 F2<Tree<A>,Tree<B>,Tree<C>> zipTreeM()
          Promotes this function to zip two trees, applying the function lock-step over both trees.
 F2<TreeZipper<A>,TreeZipper<B>,TreeZipper<C>> zipTreeZipperM()
          Promotes this function to zip two TreeZippers, applying the function lock-step over both zippers in all directions.
 F2<Zipper<A>,Zipper<B>,Zipper<C>> zipZipperM()
          Promotes this function to zip two zippers, applying the function lock-step over both zippers in both directions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

F2

public F2()
Method Detail

f

public abstract C f(A a,
                    B b)
Transform A and B to C.

Parameters:
a - The A to transform.
b - The B to transform.
Returns:
The result of the transformation.

f

public final F<B,C> f(A a)
Partial application.

Parameters:
a - The A to which to apply this function.
Returns:
The function partially applied to the given argument.

curry

public final F<A,F<B,C>> curry()
Curries this wrapped function to a wrapped function of arity-1 that returns another wrapped function.

Returns:
a wrapped function of arity-1 that returns another wrapped function.

flip

public final F2<B,A,C> flip()
Flips the arguments of this function.

Returns:
A new function with the arguments of this function flipped.

tuple

public final F<P2<A,B>,C> tuple()
Uncurries this function to a function on tuples.

Returns:
A new function that calls this function with the elements of a given tuple.

arrayM

public final F2<Array<A>,Array<B>,Array<C>> arrayM()
Promotes this function to a function on Arrays.

Returns:
This function promoted to transform Arrays.

promiseM

public final F2<Promise<A>,Promise<B>,Promise<C>> promiseM()
Promotes this function to a function on Promises.

Returns:
This function promoted to transform Promises.

iterableM

public final F2<java.lang.Iterable<A>,java.lang.Iterable<B>,IterableW<C>> iterableM()
Promotes this function to a function on Iterables.

Returns:
This function promoted to transform Iterables.

listM

public final F2<List<A>,List<B>,List<C>> listM()
Promotes this function to a function on Lists.

Returns:
This function promoted to transform Lists.

nelM

public final F2<NonEmptyList<A>,NonEmptyList<B>,NonEmptyList<C>> nelM()
Promotes this function to a function on non-empty lists.

Returns:
This function promoted to transform non-empty lists.

optionM

public final F2<Option<A>,Option<B>,Option<C>> optionM()
Promotes this function to a function on Options.

Returns:
This function promoted to transform Options.

setM

public final F2<Set<A>,Set<B>,Set<C>> setM(Ord<C> o)
Promotes this function to a function on Sets.

Parameters:
o - An ordering for the result of the promoted function.
Returns:
This function promoted to transform Sets.

streamM

public final F2<Stream<A>,Stream<B>,Stream<C>> streamM()
Promotes this function to a function on Streams.

Returns:
This function promoted to transform Streams.

treeM

public final F2<Tree<A>,Tree<B>,Tree<C>> treeM()
Promotes this function to a function on Trees.

Returns:
This function promoted to transform Trees.

zipArrayM

public final F2<Array<A>,Array<B>,Array<C>> zipArrayM()
Promotes this function to zip two arrays, applying the function lock-step over both Arrays.

Returns:
A function that zips two arrays with this function.

zipIterableM

public final F2<java.lang.Iterable<A>,java.lang.Iterable<B>,java.lang.Iterable<C>> zipIterableM()
Promotes this function to zip two iterables, applying the function lock-step over both iterables.

Returns:
A function that zips two iterables with this function.

zipListM

public final F2<List<A>,List<B>,List<C>> zipListM()
Promotes this function to zip two lists, applying the function lock-step over both lists.

Returns:
A function that zips two lists with this function.

zipStreamM

public final F2<Stream<A>,Stream<B>,Stream<C>> zipStreamM()
Promotes this function to zip two streams, applying the function lock-step over both streams.

Returns:
A function that zips two streams with this function.

zipNelM

public final F2<NonEmptyList<A>,NonEmptyList<B>,NonEmptyList<C>> zipNelM()
Promotes this function to zip two non-empty lists, applying the function lock-step over both lists.

Returns:
A function that zips two non-empty lists with this function.

zipSetM

public final F2<Set<A>,Set<B>,Set<C>> zipSetM(Ord<C> o)
Promotes this function to zip two sets, applying the function lock-step over both sets.

Parameters:
o - An ordering for the resulting set.
Returns:
A function that zips two sets with this function.

zipTreeM

public final F2<Tree<A>,Tree<B>,Tree<C>> zipTreeM()
Promotes this function to zip two trees, applying the function lock-step over both trees. The structure of the resulting tree is the structural intersection of the two trees.

Returns:
A function that zips two trees with this function.

zipZipperM

public final F2<Zipper<A>,Zipper<B>,Zipper<C>> zipZipperM()
Promotes this function to zip two zippers, applying the function lock-step over both zippers in both directions. The structure of the resulting zipper is the structural intersection of the two zippers.

Returns:
A function that zips two zippers with this function.

zipTreeZipperM

public final F2<TreeZipper<A>,TreeZipper<B>,TreeZipper<C>> zipTreeZipperM()
Promotes this function to zip two TreeZippers, applying the function lock-step over both zippers in all directions. The structure of the resulting TreeZipper is the structural intersection of the two TreeZippers.

Returns:
A function that zips two TreeZippers with this function.

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.