Exemple #1
0
 public <B> Cont<R,B> withCont(Function<Function<B,R>,Function<A,R>> transform) {
     return new Cont<>(Functions.compose(fn,transform));
 }
Exemple #2
0
 public Cont<R,A> mapCont(Function<R,R> transform) {
    return new Cont<>(Functions.compose(transform,fn));
 }
Exemple #3
0
 // (>>) (Control.Monad)
 public default <A, B> _<µ, B> semicolon(_<µ, A> nestedA, _<µ, B> nestedB) {
     return bind(nestedA, Functions.<A, _<µ, B>>constant(nestedB));
 }
Exemple #4
0
 public default <A, B> B foldr(final Function<A, Function<B, B>> fn, B b, _<F, A> as) {
     //foldr f z t = appEndo (foldMap (Endo . f) t) z
     return foldMap(Functions.<B>endoMonoid(), fn, as).apply(b);
 }
Exemple #5
0
 // join (Control.Monad)
 public default <A> _<µ, A> join(_<µ, _<µ, A>> nestedNestedA) {
     return bind(nestedNestedA, Functions.<_<µ, A>>id());
 }