/** * Promotes this function to map over a Hash as a contravariant functor. * * @return This function promoted to map over a Hash as a contravariant functor. */ public static <A, B> F<Hash<B>, Hash<A>> contramapHash(final F<A, B> f) { return h -> h.contramap(f); }
/** * A hash instance for a product-1. * * @param ha A hash for the first element of the product. * @return A hash instance for a product-1. */ public static <A> Hash<P1<A>> p1Hash(final Hash<A> ha) { return ha.contramap(P1.__1()); }
/** * A hash instance for a vector-3. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-3. */ public static <A> Hash<V3<A>> v3Hash(final Hash<A> ea) { return streamHash(ea).contramap(V3.toStream_()); }
/** * A hash instance for a vector-8. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-8. */ public static <A> Hash<V8<A>> v8Hash(final Hash<A> ea) { return streamHash(ea).contramap(V8.toStream_()); }
/** * A hash instance for the {@link Tree} type. * * @param ha A hash for the elements of the tree. * @return A hash instance for the {@link Tree} type. */ public static <A> Hash<Tree<A>> treeHash(final Hash<A> ha) { return streamHash(ha).contramap(Tree.flatten_()); }
/** * A hash instance for a vector-7. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-7. */ public static <A> Hash<V7<A>> v7Hash(final Hash<A> ea) { return streamHash(ea).contramap(V7.toStream_()); }
/** * A hash instance for the {@link Validation} type. * * @param ha Hash the failing side of <code>Validation</code>. * @param hb Hash the succeeding side of <code>Validation</code>. * @return A hash instance for the {@link Validation} type. */ public static <A, B> Hash<Validation<A, B>> validationHash(final Hash<A> ha, final Hash<B> hb) { return eitherHash(ha, hb).contramap(Validation.either()); }
/** * A hash instance for a vector-2. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-2. */ public static <A> Hash<V2<A>> v2Hash(final Hash<A> ea) { return streamHash(ea).contramap(V2.toStream_()); }
/** * A hash instance for a vector-6. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-6. */ public static <A> Hash<V6<A>> v6Hash(final Hash<A> ea) { return streamHash(ea).contramap(V6.toStream_()); }
/** * A hash instance for the {@link NonEmptyList} type. * * @param ha A hash for the elements of the non-empty list. * @return A hash instance for the {@link NonEmptyList} type. */ public static <A> Hash<NonEmptyList<A>> nonEmptyListHash(final Hash<A> ha) { return listHash(ha).contramap(NonEmptyList.toList_()); }
/** * A hash instance for a vector-4. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-4. */ public static <A> Hash<V4<A>> v4Hash(final Hash<A> ea) { return streamHash(ea).contramap(V4.toStream_()); }
/** * A hash instance for a vector-5. * * @param ea A hash for the elements of the vector. * @return A hash instance for a vector-5. */ public static <A> Hash<V5<A>> v5Hash(final Hash<A> ea) { return streamHash(ea).contramap(V5.toStream_()); }