Files
SjkScripts/Functional/Right.cs
ronnie 262b76c4d5
All checks were successful
Build NuGet / build (push) Successful in 1m43s
Refactored Option<T> to have opertator lifting and removed ref struct for now.
2026-08-07 12:58:11 -04:00

38 lines
1.2 KiB
C#

// namespace SJK.Functional;
// public sealed class Right<TLeft, TRight> : IEither<TLeft, TRight>
// {
// private readonly TRight _value;
// public Right(TRight value){
// this._value = value;
// }
// public (TLeft?, TRight?) Deconstruct()=>(default(TLeft),_value);
// public IEither<TNewLeft, TRight> MapLeft<TNewLeft>(Func<TLeft, TNewLeft> mapping)
// => new Right<TNewLeft,TRight>(this._value);
// public IEither<TLeft, TNewRight> MapRight<TNewRight>(Func<TRight, TNewRight> mapping)
// => new Right<TLeft,TNewRight>(mapping(this._value));
// public TLeft Reduce(Func<TRight, TLeft> mapping)=> mapping(this._value);
// public override string ToString()
// {
// return $"Right<{typeof(TRight).Name}> with Value {_value}";
// }
// public TResult Match<TResult>(Func<TLeft, TResult> left, Func<TRight, TResult> right)
// {
// return right(_value);
// }
// public void Match(Action<TLeft> left, Action<TRight> right)
// {
// right(_value);
// }
// public IEither<TLeft, T2> Bind< T2>(Func<TRight, IEither<TLeft, T2>> value)
// {
// return value(_value);
// }
// public bool IsRight() => false;
// }