Created
April 5, 2020 08:56
-
-
Save polyglotpiglet/2c670cd6a46be87257183b19b3e57dcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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