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 Equal<A>

java.lang.Object
  extended by fj.Equal<A>

public final class Equal<A>
extends java.lang.Object

Tests for equality between two objects.


Field Summary
static Equal<java.math.BigDecimal> bigdecimalEqual
          An equal instance for the BigDecimal type.
static Equal<java.math.BigInteger> bigintEqual
          An equal instance for the BigInteger type.
static Equal<java.lang.Boolean> booleanEqual
          An equal instance for the boolean type.
static Equal<java.lang.Byte> byteEqual
          An equal instance for the byte type.
static Equal<java.lang.Character> charEqual
          An equal instance for the char type.
static Equal<java.lang.Double> doubleEqual
          An equal instance for the double type.
static Equal<LazyString> eq
          An equal instance for lazy strings.
static Equal<java.lang.Float> floatEqual
          An equal instance for the float type.
static Equal<HList.HNil> hListEqual
          An equal instance for the empty heterogeneous list.
static Equal<java.lang.Integer> intEqual
          An equal instance for the int type.
static Equal<java.lang.Long> longEqual
          An equal instance for the long type.
static Equal<java.lang.Short> shortEqual
          An equal instance for the short type.
static Equal<java.lang.StringBuffer> stringBufferEqual
          An equal instance for the StringBuffer type.
static Equal<java.lang.StringBuilder> stringBuilderEqual
          An equal instance for the StringBuilder type.
static Equal<java.lang.String> stringEqual
          An equal instance for the String type.
 
Method Summary
static
<A> Equal<A>
anyEqual()
          Returns an equal instance that uses the Object.equals(Object) method to test for equality.
static
<A> Equal<Array<A>>
arrayEqual(Equal<A> ea)
          An equal instance for the Array type.
<B> Equal<B>
comap(F<B,A> f)
          Maps the given function across this equal as a contra-variant functor.
static
<A,B> Equal<Either<A,B>>
eitherEqual(Equal<A> ea, Equal<B> eb)
          An equal instance for the Either type.
 F2<A,A,java.lang.Boolean> eq()
          First-class equality check.
 F<A,java.lang.Boolean> eq(A a)
          Partially applied equality check.
 boolean eq(A a1, A a2)
          Returns true if the two given arguments are equal, false otherwise.
static
<A> Equal<A>
equal(F<A,F<A,java.lang.Boolean>> f)
          Constructs an equal instance from the given function.
static
<E,L extends HList<L>>
Equal<HList.HCons<E,L>>
hListEqual(Equal<E> e, Equal<L> l)
          An equal instance for heterogeneous lists.
static
<A> Equal<List<A>>
listEqual(Equal<A> ea)
          An equal instance for the List type.
static
<A> Equal<NonEmptyList<A>>
nonEmptyListEqual(Equal<A> ea)
          An equal instance for the NonEmptyList type.
static
<A> Equal<Option<A>>
optionEqual(Equal<A> ea)
          An equal instance for the Option type.
static
<A> Equal<P1<A>>
p1Equal(Equal<A> ea)
          An equal instance for a product-1.
static
<A,B> Equal<P2<A,B>>
p2Equal(Equal<A> ea, Equal<B> eb)
          An equal instance for a product-2.
static
<A,B,C> Equal<P3<A,B,C>>
p3Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec)
          An equal instance for a product-3.
static
<A,B,C,D> Equal<P4<A,B,C,D>>
p4Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed)
          An equal instance for a product-4.
static
<A,B,C,D,E>
Equal<P5<A,B,C,D,E>>
p5Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee)
          An equal instance for a product-5.
static
<A,B,C,D,E,F$>
Equal<P6<A,B,C,D,E,F$>>
p6Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef)
          An equal instance for a product-6.
static
<A,B,C,D,E,F$,G>
Equal<P7<A,B,C,D,E,F$,G>>
p7Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef, Equal<G> eg)
          An equal instance for a product-7.
static
<A,B,C,D,E,F$,G,H>
Equal<P8<A,B,C,D,E,F$,G,H>>
p8Equal(Equal<A> ea, Equal<B> eb, Equal<C> ec, Equal<D> ed, Equal<E> ee, Equal<F$> ef, Equal<G> eg, Equal<H> eh)
          An equal instance for a product-8.
static
<A> Equal<Set<A>>
setEqual(Equal<A> e)
          Equal instance for sets.
static
<A> Equal<Stream<A>>
streamEqual(Equal<A> ea)
          An equal instance for the Stream type.
static
<A> Equal<Tree<A>>
treeEqual(Equal<A> ea)
          An equal instance for the Tree type.
static
<A> Equal<V2<A>>
v2Equal(Equal<A> ea)
          An equal instance for a vector-2.
static
<A> Equal<V3<A>>
v3Equal(Equal<A> ea)
          An equal instance for a vector-3.
static
<A> Equal<V4<A>>
v4Equal(Equal<A> ea)
          An equal instance for a vector-4.
static
<A> Equal<V5<A>>
v5Equal(Equal<A> ea)
          An equal instance for a vector-5.
static
<A> Equal<V6<A>>
v6Equal(Equal<A> ea)
          An equal instance for a vector-6.
static
<A> Equal<V7<A>>
v7Equal(Equal<A> ea)
          An equal instance for a vector-7.
static
<A> Equal<V8<A>>
v8Equal(Equal<A> ea)
          An equal instance for a vector-8.
static
<A,B> Equal<Validation<A,B>>
validationEqual(Equal<A> ea, Equal<B> eb)
          An equal instance for the Validation type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

booleanEqual

public static final Equal<java.lang.Boolean> booleanEqual
An equal instance for the boolean type.


byteEqual

public static final Equal<java.lang.Byte> byteEqual
An equal instance for the byte type.


charEqual

public static final Equal<java.lang.Character> charEqual
An equal instance for the char type.


doubleEqual

public static final Equal<java.lang.Double> doubleEqual
An equal instance for the double type.


floatEqual

public static final Equal<java.lang.Float> floatEqual
An equal instance for the float type.


intEqual

public static final Equal<java.lang.Integer> intEqual
An equal instance for the int type.


bigintEqual

public static final Equal<java.math.BigInteger> bigintEqual
An equal instance for the BigInteger type.


bigdecimalEqual

public static final Equal<java.math.BigDecimal> bigdecimalEqual
An equal instance for the BigDecimal type.


longEqual

public static final Equal<java.lang.Long> longEqual
An equal instance for the long type.


shortEqual

public static final Equal<java.lang.Short> shortEqual
An equal instance for the short type.


stringEqual

public static final Equal<java.lang.String> stringEqual
An equal instance for the String type.


stringBufferEqual

public static final Equal<java.lang.StringBuffer> stringBufferEqual
An equal instance for the StringBuffer type.


stringBuilderEqual

public static final Equal<java.lang.StringBuilder> stringBuilderEqual
An equal instance for the StringBuilder type.


eq

public static final Equal<LazyString> eq
An equal instance for lazy strings.


hListEqual

public static final Equal<HList.HNil> hListEqual
An equal instance for the empty heterogeneous list.

Method Detail

eq

public boolean eq(A a1,
                  A a2)
Returns true if the two given arguments are equal, false otherwise.

Parameters:
a1 - An object to test for equality against another.
a2 - An object to test for equality against another.
Returns:
true if the two given arguments are equal, false otherwise.

eq

public F2<A,A,java.lang.Boolean> eq()
First-class equality check.

Returns:
A function that returns true if the two given arguments are equal.

eq

public F<A,java.lang.Boolean> eq(A a)
Partially applied equality check.

Parameters:
a - An object to test for equality against another.
Returns:
A function that returns true if the given argument equals the argument to this method.

comap

public <B> Equal<B> comap(F<B,A> f)
Maps the given function across this equal as a contra-variant functor.

Parameters:
f - The function to map.
Returns:
A new equal.

equal

public static <A> Equal<A> equal(F<A,F<A,java.lang.Boolean>> f)
Constructs an equal instance from the given function.

Parameters:
f - The function to construct the equal with.
Returns:
An equal instance from the given function.

anyEqual

public static <A> Equal<A> anyEqual()
Returns an equal instance that uses the Object.equals(Object) method to test for equality.

Returns:
An equal instance that uses the Object.equals(Object) method to test for equality.

eitherEqual

public static <A,B> Equal<Either<A,B>> eitherEqual(Equal<A> ea,
                                                   Equal<B> eb)
An equal instance for the Either type.

Parameters:
ea - Equality across the left side of Either.
eb - Equality across the right side of Either.
Returns:
An equal instance for the Either type.

validationEqual

public static <A,B> Equal<Validation<A,B>> validationEqual(Equal<A> ea,
                                                           Equal<B> eb)
An equal instance for the Validation type.

Parameters:
ea - Equality across the failing side of Validation.
eb - Equality across the succeeding side of Validation.
Returns:
An equal instance for the Validation type.

listEqual

public static <A> Equal<List<A>> listEqual(Equal<A> ea)
An equal instance for the List type.

Parameters:
ea - Equality across the elements of the list.
Returns:
An equal instance for the List type.

nonEmptyListEqual

public static <A> Equal<NonEmptyList<A>> nonEmptyListEqual(Equal<A> ea)
An equal instance for the NonEmptyList type.

Parameters:
ea - Equality across the elements of the non-empty list.
Returns:
An equal instance for the NonEmptyList type.

optionEqual

public static <A> Equal<Option<A>> optionEqual(Equal<A> ea)
An equal instance for the Option type.

Parameters:
ea - Equality across the element of the option.
Returns:
An equal instance for the Option type.

streamEqual

public static <A> Equal<Stream<A>> streamEqual(Equal<A> ea)
An equal instance for the Stream type.

Parameters:
ea - Equality across the elements of the stream.
Returns:
An equal instance for the Stream type.

arrayEqual

public static <A> Equal<Array<A>> arrayEqual(Equal<A> ea)
An equal instance for the Array type.

Parameters:
ea - Equality across the elements of the array.
Returns:
An equal instance for the Array type.

treeEqual

public static <A> Equal<Tree<A>> treeEqual(Equal<A> ea)
An equal instance for the Tree type.

Parameters:
ea - Equality across the elements of the tree.
Returns:
An equal instance for the Tree type.

p1Equal

public static <A> Equal<P1<A>> p1Equal(Equal<A> ea)
An equal instance for a product-1.

Parameters:
ea - Equality across the first element of the product.
Returns:
An equal instance for a product-1.

p2Equal

public static <A,B> Equal<P2<A,B>> p2Equal(Equal<A> ea,
                                           Equal<B> eb)
An equal instance for a product-2.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
Returns:
An equal instance for a product-2.

p3Equal

public static <A,B,C> Equal<P3<A,B,C>> p3Equal(Equal<A> ea,
                                               Equal<B> eb,
                                               Equal<C> ec)
An equal instance for a product-3.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
Returns:
An equal instance for a product-3.

p4Equal

public static <A,B,C,D> Equal<P4<A,B,C,D>> p4Equal(Equal<A> ea,
                                                   Equal<B> eb,
                                                   Equal<C> ec,
                                                   Equal<D> ed)
An equal instance for a product-4.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
ed - Equality across the fourth element of the product.
Returns:
An equal instance for a product-4.

p5Equal

public static <A,B,C,D,E> Equal<P5<A,B,C,D,E>> p5Equal(Equal<A> ea,
                                                       Equal<B> eb,
                                                       Equal<C> ec,
                                                       Equal<D> ed,
                                                       Equal<E> ee)
An equal instance for a product-5.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
ed - Equality across the fourth element of the product.
ee - Equality across the fifth element of the product.
Returns:
An equal instance for a product-5.

p6Equal

public static <A,B,C,D,E,F$> Equal<P6<A,B,C,D,E,F$>> p6Equal(Equal<A> ea,
                                                             Equal<B> eb,
                                                             Equal<C> ec,
                                                             Equal<D> ed,
                                                             Equal<E> ee,
                                                             Equal<F$> ef)
An equal instance for a product-6.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
ed - Equality across the fourth element of the product.
ee - Equality across the fifth element of the product.
ef - Equality across the sixth element of the product.
Returns:
An equal instance for a product-6.

p7Equal

public static <A,B,C,D,E,F$,G> Equal<P7<A,B,C,D,E,F$,G>> p7Equal(Equal<A> ea,
                                                                 Equal<B> eb,
                                                                 Equal<C> ec,
                                                                 Equal<D> ed,
                                                                 Equal<E> ee,
                                                                 Equal<F$> ef,
                                                                 Equal<G> eg)
An equal instance for a product-7.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
ed - Equality across the fourth element of the product.
ee - Equality across the fifth element of the product.
ef - Equality across the sixth element of the product.
eg - Equality across the seventh element of the product.
Returns:
An equal instance for a product-7.

p8Equal

public static <A,B,C,D,E,F$,G,H> Equal<P8<A,B,C,D,E,F$,G,H>> p8Equal(Equal<A> ea,
                                                                     Equal<B> eb,
                                                                     Equal<C> ec,
                                                                     Equal<D> ed,
                                                                     Equal<E> ee,
                                                                     Equal<F$> ef,
                                                                     Equal<G> eg,
                                                                     Equal<H> eh)
An equal instance for a product-8.

Parameters:
ea - Equality across the first element of the product.
eb - Equality across the second element of the product.
ec - Equality across the third element of the product.
ed - Equality across the fourth element of the product.
ee - Equality across the fifth element of the product.
ef - Equality across the sixth element of the product.
eg - Equality across the seventh element of the product.
eh - Equality across the eighth element of the product.
Returns:
An equal instance for a product-8.

v2Equal

public static <A> Equal<V2<A>> v2Equal(Equal<A> ea)
An equal instance for a vector-2.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-2.

v3Equal

public static <A> Equal<V3<A>> v3Equal(Equal<A> ea)
An equal instance for a vector-3.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-3.

v4Equal

public static <A> Equal<V4<A>> v4Equal(Equal<A> ea)
An equal instance for a vector-4.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-4.

v5Equal

public static <A> Equal<V5<A>> v5Equal(Equal<A> ea)
An equal instance for a vector-5.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-5.

v6Equal

public static <A> Equal<V6<A>> v6Equal(Equal<A> ea)
An equal instance for a vector-6.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-6.

v7Equal

public static <A> Equal<V7<A>> v7Equal(Equal<A> ea)
An equal instance for a vector-7.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-7.

v8Equal

public static <A> Equal<V8<A>> v8Equal(Equal<A> ea)
An equal instance for a vector-8.

Parameters:
ea - Equality across the elements of the vector.
Returns:
An equal instance for a vector-8.

hListEqual

public static <E,L extends HList<L>> Equal<HList.HCons<E,L>> hListEqual(Equal<E> e,
                                                                        Equal<L> l)
An equal instance for heterogeneous lists.

Parameters:
e - Equality for the first element of the list.
l - Equality for the rest of the list.
Returns:
an equal instance for a heterogeneous list.

setEqual

public static <A> Equal<Set<A>> setEqual(Equal<A> e)
Equal instance for sets.

Parameters:
e - Equality for the set elements.
Returns:
An equal instance for sets.

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.