internal static RndResult <B> Select <A, B>(this RndResult <A> res, Func <A, B> func) { if (!res.WasSuccessful) { return(new RndResult <B>()); } return(new RndResult <B>(func(res.Result))); }
internal static RndResult <C> SelectMany <A, B, C>( this RndResult <A> res, Func <A, RndResult <B> > func, Func <A, B, C> selector) { if (!res.WasSuccessful) { return(new RndResult <C>()); } var resB = func(res.Result); if (!resB.WasSuccessful) { return(new RndResult <C>()); } return(new RndResult <C>(selector(res.Result, resB.Result))); }
internal static RndResult <B> SelectMany <A, B>(this RndResult <A> res, Func <A, RndResult <B> > func) { return(res.SelectMany(func, (_, b) => b)); }