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