I understand the basic bind syntax for Option with functional java as
Option.some(2).bind(new F<Integer,Option<Integer>>(){
public Option<Integer>f(Integer i){
return Option.some(i/2);
}
};
That works well for single input functions but I can’t figure out how to use multiple input functions (like F2, F3, etc).
ie:
new F2<Integer,Integer,Option<Integer>>(){
public Option<Integer>f(Integer a,Integer b){
return Option.some(a/b);
}
}
I know I’m missing something, but documentation is a bit sparse.
Ideas?
Breakthrough,
The trick is you need to uncurry the arity function and bind it to the product of your options.
So in example:
arity-5 implementation
usage: