public static Either <A, B> opt <A, B>(bool condition, Fn <A> ifFalse, Fn <B> ifTrue) => condition ? Either <A, B> .Right(ifTrue()) : Either <A, B> .Left(ifFalse());
[PublicAPI] public static Future <Either <A, BB> > flatMapT <B, BB, A>( this Future <Either <A, B> > m, Fn <B, Future <BB> > mapper ) => m.flatMap(_ => _.fold( err => Future.successful(Either <A, BB> .Left(err)), from => mapper(from).map(Either <A, BB> .Right) ));
public static Either <A, B> opt <A, B>(bool condition, A ifFalse, B ifTrue) => condition ? Either <A, B> .Right(ifTrue) : Either <A, B> .Left(ifFalse);
public void WhenLeftEquals() { Either <int, string> .Left(0).shouldEqual(Either <int, string> .Left(0)); Either <int, string> .Left(10).shouldEqual(Either <int, string> .Left(10)); }
[PublicAPI] public static Future <Either <A, BB> > flatMapT <A, B, BB>( this Future <Either <A, B> > m, Fn <B, Future <Either <A, BB> > > mapper ) => m.flatMap(_ => _.fold( a => Future.successful(Either <A, BB> .Left(a)), mapper ));
[Test] public void WhenLeft() => Either <int, string> .Left(3) .toTry(onLeft) .shouldBeError(typeof(ArgumentException));
[Test] public void WhenLeft() => Either <int, string> .Left(3).swap.shouldBeRight(3);
[Test] public void WhenLeft() => Either <int, string> .Left(3).fold(folder, folder).shouldEqual('3');
[Test] public void WhenLeft() => test(Either <int, string> .Left(3), '3');
public Either <A, B> toLeft <B>(Fn <B> right) => isSome ? Either <A, B> .Left(__unsafeGetValue) : Either <A, B> .Right(right());
public Either <B, A> toRight <B>(Fn <B> left) => isSome ? Either <B, A> .Right(__unsafeGetValue) : Either <B, A> .Left(left());
[PublicAPI] public Either <B, A> toRight <B>(B left) => isSome ? Either <B, A> .Right(__unsafeGetValue) : Either <B, A> .Left(left);
[PublicAPI] public Either <A, B> toLeft <B>(B right) => isSome ? Either <A, B> .Left(__unsafeGetValue) : Either <A, B> .Right(right);
public static Either <ImmutableList <A>, B> asValidationErrors <A, B>( this ImmutableList <A> errors, Fn <B> b ) => errors.IsEmpty ? Either <ImmutableList <A>, B> .Right(b()) : Either <ImmutableList <A>, B> .Left(errors);
public Either <B, A> toRight <B>(Fn <B> left) { return(isSome ? Either <B, A> .Right(value) : Either <B, A> .Left(left())); }
public Either <A, B> toLeft <B>(Fn <B> right) { return(isSome ? Either <A, B> .Left(value) : Either <A, B> .Right(right())); }