/// <summary> /// Runs an <see cref="ITraversal{S, T, A, B}"/> on <paramref name="input"/>. /// </summary> /// <typeparam name="S">The type of the input structure.</typeparam> /// <typeparam name="T">The type of the resultant structure.</typeparam> /// <typeparam name="A">The type of the part to get.</typeparam> /// <typeparam name="B">The type of the result of the inner function.</typeparam> /// <param name="applicative">The type of the applicative result of the inner function.</param> /// <param name="lens">The traversal to run.</param> /// <param name="f">The function to apply to each element.</param> /// <param name="input">The input.</param> public static IApplicative <T> Traverse <S, T, A, B>( this ITraversal <S, T, A, B> lens, Type applicative, Func <A, IApplicative <B> > f, S input) => lens.TraversalFunc(applicative)(f)(input);
/// <summary> /// Runs an <see cref="ITraversal{S, T, A, B}"/> on <paramref name="input"/>. /// </summary> /// <typeparam name="TApplicative">The type of the applicative result of the inner function.</typeparam> /// <typeparam name="S">The type of the input structure.</typeparam> /// <typeparam name="T">The type of the resultant structure.</typeparam> /// <typeparam name="A">The type of the part to get.</typeparam> /// <typeparam name="B">The type of the result of the inner function.</typeparam> /// <param name="lens">The traversal to run.</param> /// <param name="f">The function to apply to each element.</param> /// <param name="input">The input.</param> public static IApplicative <T> Traverse <TApplicative, S, T, A, B>(this ITraversal <S, T, A, B> lens, Func <A, TApplicative> f, S input) where TApplicative : IApplicative <B> => lens.TraversalFunc(typeof(TApplicative))(x => f(x))(input);
/// <summary> /// Composes two traversals. The second traversal drills further into the result of the first. /// </summary> /// <typeparam name="S">The type of the outer container.</typeparam> /// <typeparam name="T">The type of the resulting outer container.</typeparam> /// <typeparam name="A">The type of the outer value.</typeparam> /// <typeparam name="AInner">The type of the inner outer value/inner container.</typeparam> /// <typeparam name="B">The type outer result value.</typeparam> /// <typeparam name="BInner">The type of the inner result value.</typeparam> /// <param name="lens">The outer setter.</param> /// <param name="then">The inner setter.</param> public static ITraversal <S, T, AInner, BInner> Then <S, T, A, B, AInner, BInner>(this ITraversal <S, T, A, B> lens, ITraversal <A, B, AInner, BInner> then) { return(new Traversal <S, T, AInner, BInner>(t => lens.TraversalFunc(t).After(then.TraversalFunc(t)))); }