コード例 #1
0
 /// <summary></summary>
 public static Either <L, T> NullToLeft <T, L>(
     this Optional <T> self,
     Func <L> nothing)
 => self.IfPresent(
     o => Either <L, T> .Right(o),
     () => Either <L, T> .Left(nothing()));
コード例 #2
0
 /// <summary></summary>
 public static Either <L, R> Return <L, R>(L left, TypeMarker <R> _)
 => Either <L, R> .Left(left);
コード例 #3
0
 /// <summary>LとRを交換</summary>
 public static Either <R, L> Swap <R, L>(this Either <L, R> self)
 => self.IfRight(
     r => Either <R, L> .Left(r),
     l => Either <R, L> .Right(l));
コード例 #4
0
 /// <summary></summary>
 public static Either <L, R> Return <L, R>(L left)
 => Either <L, R> .Left(left);