private static RwsResult <W, S, Unit> bmap <W, S, T>(RwsResult <W, S, T> r, Action <T> f) { if (r.IsBottom) { return(new RwsResult <W, S, Unit>(r.Output, r.State, unit, true)); } else { f(r.Value); return(new RwsResult <W, S, Unit>(r.Output, r.State, unit, false)); } }
private static RwsResult <W, S, Ret> bmap <W, S, T, Ret>(RwsResult <W, S, T> r, Func <T, Ret> f) => r.IsBottom ? new RwsResult <W, S, Ret>(r.Output, r.State, default(Ret), true) : new RwsResult <W, S, Ret>(r.Output, r.State, f(r.Value), false);