This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Description
There is a concept called the Annihilator (wikipedia) which basically defines the multiplicative zero of a set. Here's a blog post that shows an example Annihilator: http://underscore.io/blog/posts/2015/07/02/annihilators-in-scala.html
I'm interested in such a type class included here. A sample use case would be set intersection: consider the following pieces of code, reflecting use of a Monoid[Option[?]].
Hypothetical monoid
implicit object IntSetIntersectionMonoid extends Monoid[Set[Int]] {
def append(a: Set[Int], b: => Set[Int]): Set[Int] = a intersect b
def identity = // the universe. This is impossible, which is why we need the annihilator to exist
def zero = Set()
}
Existing monoid:
val a = Set(1, 2).some
val b = none
a |+| b // returns Set(1, 2)
With annihilation:
val a = Set(1, 2).some
val b = none
a |*| b // returns empty set
There are possibly many other examples other than set intersection that may be useful. Also, apologies if anything is unclear. This is my first time using GitHub issues. Thanks!