Esempio n. 1
0
 public static type One <type>(this SNeutral <type, Multiplicative <Unit> > neu) => neu.Unit();
Esempio n. 2
0
 // Because of multiple interface inheritance compiler can't decide what type arguments are
 // To be more specific, it can't deal with parameteric polymorphism of the second rank
 // so specialized extensions are provided for some operations
 public static type Zero <type>(this SNeutral <type, Additive <Unit> > neu) => neu.Unit();
Esempio n. 3
0
 public static type Max <type, mark>(this SNeutral <type, Supremum <mark> > that) => that.Unit();
Esempio n. 4
0
 public static type Min <type, mark>(this SNeutral <type, Infimum <mark> > that) => that.Unit();
Esempio n. 5
0
 public static type Unit <type, mark>(this SNeutral <type, mark> neu) => neu.NullOp();
Esempio n. 6
0
 /// <summary>
 /// Ensure that contained value (if any) satisfies the predicate or else return Left
 /// Enumerable.Where-like filter
 /// </summary>
 public static Either <left, right> Filter <left, right>(this Either <left, right> that, Func <right, bool> p, SNeutral <left, Unit> neutral = null) => // todo resolve neutral
 that.Map(p).GetRightOr(false) ? that : that.Alg().InjectLeft((neutral ?? AObject <left> .Class).NullOp());