/// <summary> /// Folds the either into an S /// https://en.wikipedia.org/wiki/Fold_(higher-order_function) /// </summary> /// <typeparam name="S">State</typeparam> /// <typeparam name="L">Left</typeparam> /// <typeparam name="R">Right</typeparam> /// <param name="self">Either to fold</param> /// <param name="state">Initial state</param> /// <param name="Right">Right fold function</param> /// <param name="Left">Left fold function</param> /// <returns>Folded state</returns> public static S fold <L, R, S>(EitherUnsafe <L, R> either, S state, Func <S, R, S> Right, Func <S, L, S> Left) => either.Fold(state, Right, Left);
/// <summary> /// Folds the either into an S /// https://en.wikipedia.org/wiki/Fold_(higher-order_function) /// </summary> /// <typeparam name="S">State</typeparam> /// <typeparam name="L">Left</typeparam> /// <typeparam name="R">Right</typeparam> /// <param name="either">Either to fold</param> /// <param name="state">Initial state</param> /// <param name="folder">Fold function</param> /// <returns>Folded state</returns> public static S fold <S, L, R>(EitherUnsafe <L, R> either, S state, Func <S, L, S> folder) => either.Fold(state, folder);