Example #1
0
 public static MonadOr <TSource> Where <TSource>(
     this MonadOr <TSource> @this,
     Func <TSource, bool> predicate)
 {
     Require.NotNull(@this, nameof(@this));
     Require.NotNull(predicate, nameof(predicate));
     return(@this.Bind(val => predicate(val) ? MonadOr <TSource> .η(val) : MonadOr <TSource> .None));
 }
Example #2
0
 public static MonadOr <TResult> Select <TSource, TResult>(
     this MonadOr <TSource> @this,
     Func <TSource, TResult> selector)
 {
     Require.NotNull(@this, nameof(@this));
     Require.NotNull(selector, nameof(selector));
     return(@this.Bind(val => MonadOr <TResult> .η(selector(val))));
 }