Created
February 17, 2017 23:42
-
-
Save vvviiimmm/b9d9380911adfed42db0dd7ac4e933ae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def sum[A:Monoid](values: Seq[A]): A = { | |
val ev = implicitly[Monoid[A]] | |
values.foldLeft(ev.zero)(ev.plus) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment