예제 #1
0
 public static IBifunctor <TFirstResult, TSecondResult> Bimap <TFirst, TFirstResult, TSecond, TSecondResult>(
     IBifunctor <TFirst, TSecond> bifunctor,
     Func <TFirst, TFirstResult> firstSelector,
     Func <TSecond, TSecondResult> secondSelector)
 {
     return(bifunctor.SelectBoth(firstSelector, secondSelector));
 }
예제 #2
0
 public static IBifunctor <TFirst, TResult> SelectSecond <TFirst, TSecond, TResult>(
     IBifunctor <TFirst, TSecond> bifunctor,
     Func <TSecond, TResult> selector)
 {
     return(bifunctor.Select(selector));
 }
예제 #3
0
 /// <summary>
 /// Applies an action to the right part of a <see cref="IBifunctor{TLeft, TRight}"/> and returns it.
 /// </summary>
 /// <typeparam name="TLeft">The type of the left values.</typeparam>
 /// <typeparam name="TRight">The type of the right values.</typeparam>
 /// <param name="this">The bifunctor to apply over.</param>
 /// <param name="f">The function to apply.</param>
 public static IBifunctor <TLeft, TRight> RightMap <TLeft, TRight>(this IBifunctor <TLeft, TRight> @this, Action <TRight> f)
 => @this.BiMap(x => x, y => { f(y); return(y); });
예제 #4
0
 /// <summary>
 /// Maps over just the right part of a <see cref="IBifunctor{TLeft, TRight}"/>.
 /// </summary>
 /// <typeparam name="TLeft">The type of the left values.</typeparam>
 /// <typeparam name="TRight">The type of the right values.</typeparam>
 /// <typeparam name="TRightResult">The type of the right result.</typeparam>
 /// <param name="this">The bifunctor to apply over.</param>
 /// <param name="f">The function to apply.</param>
 public static IBifunctor <TLeft, TRightResult> RightMap <TLeft, TRight, TRightResult>(this IBifunctor <TLeft, TRight> @this, Func <TRight, TRightResult> f)
 => @this.BiMap(x => x, f);
예제 #5
0
 /// <summary>
 /// Applies an action to the left part of a <see cref="IBifunctor{TLeft, TRight}"/> and returns it.
 /// </summary>
 /// <typeparam name="TLeft">The type of the left values.</typeparam>
 /// <typeparam name="TRight">The type of the right values.</typeparam>
 /// <param name="this">The bifunctor to apply over.</param>
 /// <param name="f">The function to apply.</param>
 public static IBifunctor <TLeft, TRight> LeftMap <TLeft, TRight>(this IBifunctor <TLeft, TRight> @this, Action <TLeft> f)
 => @this.BiMap(y => { f(y); return(y); }, x => x);
예제 #6
0
 /// <summary>
 /// Maps over just the left part of a <see cref="IBifunctor{TLeft, TRight}"/>.
 /// </summary>
 /// <typeparam name="TLeft">The type of the left values.</typeparam>
 /// <typeparam name="TRight">The type of the right values.</typeparam>
 /// <typeparam name="TLeftResult">The type of the left result.</typeparam>
 /// <param name="this">The bifunctor to apply over.</param>
 /// <param name="f">The function to apply.</param>
 public static IBifunctor <TLeftResult, TRight> LeftMap <TLeft, TRight, TLeftResult>(this IBifunctor <TLeft, TRight> @this, Func <TLeft, TLeftResult> f)
 => @this.BiMap(f, x => x);