public static bool HasIdentity <MONOID, T>(T x, IEqualityComparer <T> comparer = null) where MONOID : struct, IMonoid <T> { comparer ??= EqualityComparer <T> .Default; return(comparer.Equals(Monoid.Concat <MONOID, T>(x, Monoid.Empty <MONOID, T>()), x) && comparer.Equals(Monoid.Concat <MONOID, T>(Monoid.Empty <MONOID, T>(), x), x)); }