public static MonadPlus <TSource> Where <TSource>( this MonadPlus <TSource> @this, Func <TSource, bool> predicate) { Require.NotNull(@this, nameof(@this)); Require.NotNull(predicate, nameof(predicate)); return(@this.Bind(val => predicate(val) ? MonadPlus <TSource> .η(val) : MonadPlus <TSource> .Zero)); }
public static MonadPlus <TResult> Select <TSource, TResult>( this MonadPlus <TSource> @this, Func <TSource, TResult> selector) { Require.NotNull(@this, nameof(@this)); Require.NotNull(selector, nameof(selector)); return(@this.Bind(val => MonadPlus <TResult> .η(selector(val)))); }