Skip to content

Instantly share code, notes, and snippets.

@davidandrzej
Last active August 29, 2015 14:04
Show Gist options
  • Save davidandrzej/274da5ddfb2b96ce6ec8 to your computer and use it in GitHub Desktop.
Save davidandrzej/274da5ddfb2b96ce6ec8 to your computer and use it in GitHub Desktop.
Excerpted from https://github.com/scalaz/scalaz for instructional purposes
trait Monoid[F] extends Semigroup[F] {
...
trait MonoidLaw extends SemigroupLaw {
def leftIdentity(a: F)(implicit F: Equal[F]) =
F.equal(a, append(zero, a))
def rightIdentity(a: F)(implicit F: Equal[F]) =
F.equal(a, append(a, zero))
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment