public static type One <type>(this SNeutral <type, Multiplicative <Unit> > neu) => neu.Unit();
// 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();
public static type Max <type, mark>(this SNeutral <type, Supremum <mark> > that) => that.Unit();
public static type Min <type, mark>(this SNeutral <type, Infimum <mark> > that) => that.Unit();
public static type Unit <type, mark>(this SNeutral <type, mark> neu) => neu.NullOp();
/// <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());