Пример #1
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); });
Пример #2
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);
Пример #3
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);
Пример #4
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);