Ejemplo n.º 1
0
 public static Maybe <T> Return <T>(T x) => Maybe.Just(x);
Ejemplo n.º 2
0
 public static Maybe <TResult> Bind <T, TResult>(this Maybe <T> m, Func <T, Maybe <TResult> > f) =>
 m.HasValue
         ? f(m.Value)
         : Maybe.Nothing <TResult>();
Ejemplo n.º 3
0
 public static Maybe <TResult> Map <T, TResult>(this Maybe <T> m, Func <T, TResult> f) =>
 m.HasValue
         ? Maybe.Just(f(m.Value))
         : Maybe.Nothing <TResult>();