public static U Fold <T, U>(this Maybe <T> ts, U identity, Func <U, T, U> fn) { var accumulator = identity; foreach (T element in ts.AsEnumerable()) { accumulator = fn(accumulator, element); } return(accumulator); }
public static void ForEach <A>(this Maybe <A> @this, Action <A> f) => @this.AsEnumerable().ForEach(f);