public static IMonad <TB> Select <TA, TB>(this IMonad <TA> ma, Func <TA, TB> f) { var monadAdapter = ma.GetMonadAdapter(); return(monadAdapter.Bind( ma, a => monadAdapter.Return(f(a)))); }
public static IMonad <TC> SelectMany <TA, TB, TC>(this IMonad <TA> ma, Func <TA, IMonad <TB> > f1, Func <TA, TB, TC> f2) { var monadAdapter = ma.GetMonadAdapter(); return(monadAdapter.Bind( ma, a => monadAdapter.Bind( f1(a), b => monadAdapter.Return(f2(a, b))))); }
public static IMonad <TB> SelectMany <TA, TB>(this IMonad <TA> ma, Func <TA, IMonad <TB> > f) { var monadAdapter = ma.GetMonadAdapter(); return(monadAdapter.Bind(ma, f)); }