Exemplo n.º 1
0
 public <B> Cont<R,B> withCont(Function<Function<B,R>,Function<A,R>> transform) {
     return new Cont<>(Functions.compose(fn,transform));
 }
Exemplo n.º 2
0
 public Cont<R,A> mapCont(Function<R,R> transform) {
    return new Cont<>(Functions.compose(transform,fn));
 }
Exemplo n.º 3
0
 // (>>) (Control.Monad)
 public default <A, B> _<µ, B> semicolon(_<µ, A> nestedA, _<µ, B> nestedB) {
     return bind(nestedA, Functions.<A, _<µ, B>>constant(nestedB));
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 // join (Control.Monad)
 public default <A> _<µ, A> join(_<µ, _<µ, A>> nestedNestedA) {
     return bind(nestedNestedA, Functions.<_<µ, A>>id());
 }