Beispiel #1
0
 /// <summary>
 /// Non-empty opt projection
 /// </summary>
 public static val Some <val>(this Opt <val> that) =>
 that.Case(Failing <val> .Tag(that, nameof(Some)), (t, _) => t.ToValue(), Unit(), Snd);
Beispiel #2
0
 /// <summary>
 /// `Greater than` projection
 /// </summary>
 public static Unit Gt(this Ord that) =>
 that.Case(Failing <Unit> .Tag(that, nameof(Lt)), Failing <Unit> .Tag(that, nameof(Lt)), Id);
Beispiel #3
0
 /// <summary>
 /// Empty opt projection
 /// </summary>
 public static Unit None <val>(this Opt <val> that) =>
 that.Case(Unit(), Snd, Failing <Unit> .Tag(that, nameof(None)), (t, _) => t.ToValue());
Beispiel #4
0
 /// <summary>
 /// `Less than` projection
 /// </summary>
 public static Unit Lt(this Ord that) =>
 that.Case(Id, Failing <Unit> .Tag(that, nameof(Lt)), Failing <Unit> .Tag(that, nameof(Lt)));
Beispiel #5
0
 /// <summary>
 /// Right projection
 /// </summary>
 public static right Right <left, right>(this Either <left, right> that) =>
 that.Case(Failing <right> .Tag(that, nameof(Right)), (t, _) => t.ToValue(), Unit(), Snd);
Beispiel #6
0
 /// <summary>
 /// Left projection
 /// </summary>
 public static left Left <left, right>(this Either <left, right> that) =>
 that.Case(Unit(), Snd, Failing <left> .Tag(that, nameof(Left)), (t, _) => t.ToValue());
Beispiel #7
0
 /// <summary>
 /// Non-empty list projection
 /// </summary>
 public static Pair <val, List <val> > Cons <val>(this List <val> that) =>
 that.Case(Failing <Pair <val, List <val> > > .Tag(that, nameof(Cons)), (t, _) => t.ToValue(), Unit(), Snd);
Beispiel #8
0
 /// <summary>
 /// Empty list projection
 /// </summary>
 public static Unit Nil <val>(this List <val> that) =>
 that.Case(Unit(), Snd, Failing <Unit> .Tag(that, nameof(Nil)), (t, _) => t.ToValue());