Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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());
Ejemplo n.º 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)));
Ejemplo n.º 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);
Ejemplo n.º 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());
Ejemplo n.º 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);
Ejemplo n.º 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());