mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
572 B
16 lines
572 B
using System.Threading.Tasks; |
|
using LanguageExt; |
|
|
|
namespace ErsatzTV.Core |
|
{ |
|
public static class LanguageExtensions |
|
{ |
|
public static Either<BaseError, TR> ToEither<TR>(this Validation<BaseError, TR> validation) => |
|
validation.ToEither().MapLeft(errors => errors.Join()); |
|
|
|
public static Task<Either<BaseError, TR>> ToEitherAsync<TR>(this Validation<BaseError, Task<TR>> validation) => |
|
validation.ToEither() |
|
.MapLeft(errors => errors.Join()) |
|
.MapAsync<BaseError, Task<TR>, TR>(e => e); |
|
} |
|
}
|
|
|