/// <summary> /// Returns the leftValue if the Either is in a Right state. /// Returns the Left value if the Either is in a Left state. /// </summary> /// <param name="leftValue">Value to return if in the Left state</param> /// <returns>Returns an unwrapped Left value</returns> public static L ifRightUnsafe <L, R>(EitherUnsafe <L, R> either, L leftValue) => either.IfRightUnsafe(leftValue);
/// <summary> /// Returns the result of leftMap if the Either is in a Right state. /// Returns the Left value if the Either is in a Left state. /// </summary> /// <param name="leftMap">Function to generate a Left value if in the Right state</param> /// <returns>Returns an unwrapped Left value</returns> public static L ifRightUnsafe <L, R>(EitherUnsafe <L, R> either, Func <R, L> leftMap) => either.IfRightUnsafe(leftMap);
/// <summary> /// Invokes the Right action if the Either is in a Right state, otherwise does nothing /// </summary> /// <param name="Right">Action to invoke</param> /// <returns>Unit</returns> public static Unit ifRightUnsafe <L, R>(EitherUnsafe <L, R> either, Action <R> Right) => either.IfRightUnsafe(Right);
/// <summary> /// Returns the result of Left() if the Either is in a Right state. /// Returns the Left value if the Either is in a Left state. /// </summary> /// <param name="Left">Function to generate a Left value if in the Right state</param> /// <returns>Returns an unwrapped Left value</returns> public static L ifRightUnsafe <L, R>(EitherUnsafe <L, R> either, Func <L> Left) => either.IfRightUnsafe(Left);