88import static com .jnape .palatable .lambda .functions .builtin .fn1 .Id .id ;
99
1010/**
11- * A dually-parametric functor that maps contravariantly over the left parameter and covariantly over the
12- * right.
11+ * A dually-parametric functor that maps contravariantly over the left parameter and covariantly over the right.
1312 * <p>
1413 * For more information, read about <a href="https://en.wikipedia.org/wiki/Profunctor" target="_top">Profunctors</a>.
1514 *
1817 * @param <PF> The unification parameter
1918 * @see Functor
2019 * @see Bifunctor
20+ * @see Contravariant
2121 * @see Fn1
2222 * @see Lens
2323 */
2424@ FunctionalInterface
25- public interface Profunctor <A , B , PF extends Profunctor > {
25+ public interface Profunctor <A , B , PF extends Profunctor > extends Contravariant <A , Profunctor <?, B , PF >> {
26+
27+ /**
28+ * Dually map contravariantly over the left parameter and covariantly over the right parameter. This is isomorphic
29+ * to <code>diMapL(lFn).diMapR(rFn)</code>.¬
30+ *
31+ * @param <Z> the new left parameter type
32+ * @param <C> the new right parameter type
33+ * @param lFn the left parameter mapping function
34+ * @param rFn the right parameter mapping function
35+ * @return a profunctor over Z (the new left parameter type) and C (the new right parameter type)
36+ */
37+ <Z , C > Profunctor <Z , C , PF > diMap (Function <? super Z , ? extends A > lFn , Function <? super B , ? extends C > rFn );
2638
2739 /**
2840 * Contravariantly map over the left parameter.
@@ -48,14 +60,10 @@ default <C> Profunctor<A, C, PF> diMapR(Function<? super B, ? extends C> fn) {
4860 }
4961
5062 /**
51- * Dually map contravariantly over the left parameter and covariantly over the right parameter. This is isomorphic
52- * to <code>diMapL(lFn).diMapR(rFn)</code>.
53- *
54- * @param <Z> the new left parameter type
55- * @param <C> the new right parameter type
56- * @param lFn the left parameter mapping function
57- * @param rFn the right parameter mapping function
58- * @return a profunctor over Z (the new left parameter type) and C (the new right parameter type)
63+ * @inheritDoc
5964 */
60- <Z , C > Profunctor <Z , C , PF > diMap (Function <? super Z , ? extends A > lFn , Function <? super B , ? extends C > rFn );
65+ @ Override
66+ default <Z > Profunctor <Z , B , PF > contraMap (Function <? super Z , ? extends A > fn ) {
67+ return diMapL (fn );
68+ }
6169}
0 commit comments