Example #1
0
 public static Maybe <T> Return <T>(T x) => Maybe.Just(x);
Example #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>();
Example #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>();