Exemplo n.º 1
0
 /// <summary>
 /// Combines <c>Io</c>'s but constructing new <c>IO</c>s
 /// that eval and append the results of the original <c>IO</c>s.
 /// </summary>
 public static Monoid <Io <A> > Io <A>(Monoid <A> monoid) => Of(
     () => IoMonad.Of(() => monoid.Default),
     (x, y) => IoMonad.Of(() => monoid.Concat(x.Eval(), y.Eval())));
Exemplo n.º 2
0
 /// <summary>
 /// Combines <c>Some</c>s, ignoring <c>None</c>s.
 /// </summary>
 public static Monoid <Maybe <A> > Maybe <A>(Monoid <A> monoid) =>
 Of(None <A>, (x, y) => x.AndOr(y, monoid.Concat));