We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3bf125 commit 158aabfCopy full SHA for 158aabf
core/src/main/java/fj/Semigroup.java
@@ -105,6 +105,14 @@ public Semigroup<A> dual() {
105
return semigroup(flip(sum));
106
}
107
108
+ /**
109
+ * Lifts the semigroup to obtain a trivial monoid.
110
+ */
111
+ public Monoid<Option<A>> lift() {
112
+ return Monoid.monoid(a -> b -> Option.liftM2(sum).f(a).f(b).orElse(a).orElse(b), Option.none());
113
+ }
114
+
115
116
* Constructs a semigroup from the given function.
117
*
118
* @param sum The function to construct this semigroup with.
0 commit comments