38 lines
1.2 KiB
C#
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;
|
|
// } |