File tree Expand file tree Collapse file tree
src/main/java/com/jnape/palatable/lambda/functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111import static com .jnape .palatable .lambda .adt .Unit .UNIT ;
1212import static com .jnape .palatable .lambda .functions .builtin .fn1 .Constantly .constantly ;
13+ import static com .jnape .palatable .lambda .functions .specialized .SideEffect .NOOP ;
1314import static com .jnape .palatable .lambda .io .IO .io ;
1415
1516/**
@@ -90,6 +91,16 @@ static Effect<Unit> effect(SideEffect sideEffect) {
9091 return effect (constantly (io (sideEffect )));
9192 }
9293
94+ /**
95+ * Create an {@link Effect} that accepts an input and does nothing;
96+ *
97+ * @return the noop {@link Effect}
98+ */
99+ @ SuppressWarnings ("unused" )
100+ static <A > Effect <A > noop () {
101+ return effect (NOOP ).contraMap (constantly (UNIT ));
102+ }
103+
93104 /**
94105 * Create an {@link Effect} from an {@link Fn1} that yields an {@link IO}.
95106 *
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public interface SideEffect {
1717 /**
1818 * A no-op {@link SideEffect}
1919 */
20- @ SuppressWarnings ( "unused" ) SideEffect NOOP = () -> {};
20+ SideEffect NOOP = () -> {};
2121
2222 @ SuppressWarnings ("NonAsciiCharacters" )
2323 void Ω () throws Throwable ;
You can’t perform that action at this time.
0 commit comments