File tree Expand file tree Collapse file tree 5 files changed +41
-4
lines changed
Expand file tree Collapse file tree 5 files changed +41
-4
lines changed Original file line number Diff line number Diff line change 11package fj ;
22
3+ import java .util .function .Supplier ;
4+
35/**
46 * Created by MarkPerry on 21/01/2015.
57 */
68@ FunctionalInterface
7- public interface F0 <A > {
9+ public interface F0 <A > extends Supplier < A > {
810
911 A f ();
1012
13+ default A get () {
14+ return f ();
15+ }
16+
1117}
Original file line number Diff line number Diff line change 66
77import fj .F ;
88import fj .Unit ;
9+ import fj .function .Try0 ;
910
1011import java .io .IOException ;
1112
1718 * @param <A> the type of the result produced by the IO
1819 */
1920@ FunctionalInterface
20- public interface IO <A > {
21+ public interface IO <A > extends Try0 < A , IOException > {
2122
2223 A run () throws IOException ;
2324
25+ default A f () throws IOException {
26+ return run ();
27+ }
28+
2429 default SafeIO <Validation <IOException , A >> safe () {
2530 return IOFunctions .toSafeValidation (this );
2631 }
Original file line number Diff line number Diff line change 11package fj .function ;
22
3+ import fj .F0 ;
4+
35/**
46 * Created by mperry on 28/08/2014.
57 */
Original file line number Diff line number Diff line change 11package fj .function ;
22
3+ import fj .F ;
4+ import fj .Unit ;
5+
6+ import java .util .function .Consumer ;
7+
8+ import static fj .Unit .unit ;
9+
310/**
411 * Created by mperry on 28/08/2014.
512 */
6- public interface Effect1 <A > {
13+ public interface Effect1 <A > extends Consumer < A > {
714
815 void f (A a );
916
17+ default void accept (A a ) {
18+ f (a );
19+ }
20+
21+ default F <A , Unit > toF () {
22+ return a -> {
23+ f (a );
24+ return unit ();
25+ };
26+ }
27+
1028}
Original file line number Diff line number Diff line change 11package fj .function ;
22
3+ import java .util .function .BiConsumer ;
4+
35/**
46 * Created by mperry on 28/08/2014.
57 */
6- public interface Effect2 <A , B > {
8+ public interface Effect2 <A , B > extends BiConsumer < A , B > {
79
810 void f (A a , B b );
911
12+ default void accept (A a , B b ) {
13+ f (a , b );
14+ }
15+
1016}
You can’t perform that action at this time.
0 commit comments