Skip to content

Commit 739f8d7

Browse files
committed
Improving Exchange docs
1 parent 5a734c5 commit 739f8d7

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • src/main/java/com/jnape/palatable/lambda/functor/builtin

‎src/main/java/com/jnape/palatable/lambda/functor/builtin/Exchange.java‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.jnape.palatable.lambda.functor.builtin;
22

33
import com.jnape.palatable.lambda.functor.Profunctor;
4+
import com.jnape.palatable.lambda.optics.Iso;
45

56
import java.util.function.Function;
67

@@ -21,30 +22,52 @@ public Exchange(Function<? super S, ? extends A> sa, Function<? super B, ? exten
2122
this.bt = bt;
2223
}
2324

25+
/**
26+
* Extract the mapping <code>S -&gt; A</code>.
27+
*
28+
* @return a <code>{@link Function}&lt;S, A&gt;</code>
29+
*/
2430
public Function<? super S, ? extends A> sa() {
2531
return sa;
2632
}
2733

34+
/**
35+
* Extract the mapping <code>B -&gt; T</code>.
36+
*
37+
* @return a <code>{@link Function}&lt;B, T&gt;</code>
38+
*/
2839
public Function<? super B, ? extends T> bt() {
2940
return bt;
3041
}
3142

43+
/**
44+
* {@inheritDoc}
45+
*/
3246
@Override
3347
public <Z, C> Exchange<A, B, Z, C> diMap(Function<? super Z, ? extends S> lFn,
3448
Function<? super T, ? extends C> rFn) {
3549
return new Exchange<>(lFn.andThen(sa), bt.andThen(rFn));
3650
}
3751

52+
/**
53+
* {@inheritDoc}
54+
*/
3855
@Override
3956
public <Z> Exchange<A, B, Z, T> diMapL(Function<? super Z, ? extends S> fn) {
4057
return (Exchange<A, B, Z, T>) Profunctor.super.<Z>diMapL(fn);
4158
}
4259

60+
/**
61+
* {@inheritDoc}
62+
*/
4363
@Override
4464
public <C> Exchange<A, B, S, C> diMapR(Function<? super T, ? extends C> fn) {
4565
return (Exchange<A, B, S, C>) Profunctor.super.<C>diMapR(fn);
4666
}
4767

68+
/**
69+
* {@inheritDoc}
70+
*/
4871
@Override
4972
public <Z> Exchange<A, B, Z, T> contraMap(Function<? super Z, ? extends S> fn) {
5073
return (Exchange<A, B, Z, T>) Profunctor.super.<Z>contraMap(fn);

0 commit comments

Comments
 (0)