summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/typeclasses/PFLens.java
blob: 3574cdef7d7e05712d64caf447457fde513ac7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package bjc.typeclasses;

import java.util.function.Function;

/**
 * A profunctor lens
 * 
 * @author bjcul
 *
 * @param <Whole1> The first whole
 * @param <Whole2> The second whole
 * @param <Part1> The first part
 * @param <Part2> The second part
 */
public interface PFLens<Whole1, Whole2, Part1, Part2> {
	// Container should be Functor once that is ironed out
	/**
	 * Run the lens in the given functor
	 * 
	 * @param <A> First argument 
	 * @param <B> second argument
	 * @param <F> Underlying functor
	 * 
	 * @param f The function to apply
	 * 
	 * @return The result of applying the functor
	 */
	<A, B, F extends Container<?, F>> Function<Whole1, Container<Whole2, F>> run(Function<Part1, Container<Part2, F>> f);
}