Ejemplo n.º 1
0
 [PublicAPI] public static Either <Left, ImmutableList <To> > mapRightC <From, To, Left>(
     this Either <Left, ImmutableList <From> > e, Fn <From, To> mapper
     ) => mapRightC(e, mapper, _ => _.ToImmutableList());
Ejemplo n.º 2
0
 public EitherEnumerator(Either <A, B> either) : this()
 {
     this.either = either;
 }
Ejemplo n.º 3
0
 [PublicAPI] public static Either <ImmutableList <To>, Right> mapLeftC <From, To, Right>(
     this Either <ImmutableList <From>, Right> e, Fn <From, To> mapper
     ) => mapLeftC(e, mapper, _ => _.ToImmutableList());
Ejemplo n.º 4
0
 [PublicAPI] public static Either <IEnumerable <ElemTo>, Right> mapLeftC <CollFrom, Right, ElemFrom, ElemTo>(
     this Either <CollFrom, Right> e,
     Fn <ElemFrom, ElemTo> mapper
     ) where CollFrom : IEnumerable <ElemFrom> =>
 e.mapLeft(mapC <CollFrom, ElemFrom, ElemTo>(mapper));
Ejemplo n.º 5
0
 [PublicAPI] public static Either <Left, IEnumerable <ElemTo> > mapRightC <CollFrom, Left, ElemFrom, ElemTo>(
     this Either <Left, CollFrom> e,
     Fn <ElemFrom, ElemTo> mapper
     ) where CollFrom : IEnumerable <ElemFrom> =>
 e.mapRight(mapC <CollFrom, ElemFrom, ElemTo>(mapper));
Ejemplo n.º 6
0
 public Either <A, B> toLeft <B>(Fn <B> right)
 {
     return(isSome ? Either <A, B> .Left(value) : Either <A, B> .Right(right()));
 }
Ejemplo n.º 7
0
 [PublicAPI] public static Either <A, B> flatten <A, B>(this Either <A, Either <A, B> > e) =>
 e.flatMapRight(_ => _);
Ejemplo n.º 8
0
 [PublicAPI] public Either <B, A> toRight <B>(B left) =>
 isSome ? Either <B, A> .Right(__unsafeGetValue) : Either <B, A> .Left(left);
Ejemplo n.º 9
0
 public Either <A, B> toLeft <B>(Fn <B> right) =>
 isSome ? Either <A, B> .Left(__unsafeGetValue) : Either <A, B> .Right(right());
Ejemplo n.º 10
0
 public static Either <L, R2> SelectMany <L, R, R1, R2>(
     this Either <L, R> opt, Fn <R, Either <L, R1> > f, Fn <R, R1, R2> g
     ) => opt.flatMapRight(f, g);
Ejemplo n.º 11
0
 [PublicAPI] public Either <A, B> toLeft <B>(B right) =>
 isSome ? Either <A, B> .Left(__unsafeGetValue) : Either <A, B> .Right(right);
Ejemplo n.º 12
0
 public static Either <L, R1> SelectMany <L, R, R1>(this Either <L, R> e, Fn <R, Either <L, R1> > f) =>
 e.flatMapRight(f);
Ejemplo n.º 13
0
 public static Either <L, R1> Select <L, R, R1>(this Either <L, R> e, Fn <R, R1> f) =>
 e.mapRight(f);
Ejemplo n.º 14
0
 public Either <B, A> toRight <B>(Fn <B> left)
 {
     return(isSome ? Either <B, A> .Right(value) : Either <B, A> .Left(left()));
 }
Ejemplo n.º 15
0
   [PublicAPI] 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);
Ejemplo n.º 16
0
 public Either <B, A> toRight <B>(Fn <B> left) =>
 isSome ? Either <B, A> .Right(__unsafeGetValue) : Either <B, A> .Left(left());
Ejemplo n.º 17
0
   [PublicAPI] 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());
Ejemplo n.º 18
0
 public static Either <ImmutableList <A>, B> asValidation <A, B>(
     this Either <A, B> e1
     )
 {
     return(e1.mapLeft(ImmutableList.Create));
 }