Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save polyglotpiglet/2c670cd6a46be87257183b19b3e57dcb to your computer and use it in GitHub Desktop.
Save polyglotpiglet/2c670cd6a46be87257183b19b3e57dcb to your computer and use it in GitHub Desktop.
// eg union of non empty sets
trait MySemigroup[A] {
// must be associative
def combine(a1: A, a2: A): A
}
// eg union of sets, where the empty set is the identity element
trait MyMonoid[A] extends MySemigroup[A] {
// is an identity element
def empty: A
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment