using System.Collections.Generic;
public record Legacy(string LegacyId, Guid uniqueId);
public static void Main()
var x = Either<int, int>.Right(1);
var y = Either<int, int>.Right(2);
var z = Either<int, int>.Left(5);
var eitherOutput = Try<string>(() => throw new Exception("hey"));
var xx = Lift2((x, y) => x + y, x, y);
x => Console.WriteLine(x.ToString()),
public static class Module
public static Either<A, A> Lift2<A> (Func<A, A, A> f, Either<A, A> x, Either<A, A> y) => x.Bind(x_ => y.Map(y_ => f(x_, y_)));
public static Either<Exception, S> Try<S>(Func<S> f)
return Either<Exception, S>.Right(f());
return Either<Exception, S>.Left(e);