コード例 #1
0
 /// <summary>
 /// Runs a setter with an update-function on an input, returns the modified input.
 /// Also known as <em>over</em>.
 /// </summary>
 public static T Update <S, T, A, B>(this ISetter <S, T, A, B> lens, S input, Func <A, B> f)
 => lens.SetFunc(a => new Identity <B>(f(a)))(input).Value;
コード例 #2
0
 /// <summary>
 /// Runs a setter on an input and returns the modified input.
 /// Also known as <em>set</em>.
 /// </summary>
 public static T Set <S, T, A, B>(this ISetter <S, T, A, B> lens, S input, B value)
 => lens.SetFunc(_ => new Identity <B>(value))(input).Value;