u/kubukozcats,cats-effectin r/scala • Recommends
What are monoids and how to use them - Scala tutorial
3.7K subscribers • 30 videos on Hallway
Beginner. No background in the topic needed.
3.9K views7 years ago1 recommendation
Programming languagesSoftware designScalaFunctional programmingDesign patterns
Jakub Kozłowski introduces the Monoid and Semigroup type classes in Scala, explaining their rules and demonstrating common use cases.
This video will introduce you to the Monoid and Semigroup type classes, their powers and rules that they have to obey. You'll see examples of common instances of these type classes as well as some more interesting ones, like the Map monoid. You'll also find out why a single type could have more than one lawful instance of the Monoid type class. Table of contents: - Introduction - Definitions of Semigroup and Monoid - Example: adding Integers - Example: concatenating Strings - Example: List monoid - Alternative monoids: Product monoid for Int - combineAll - foldMap - More advanced example: Map monoid (accumulating lists of values) - Map monoid: grouping list elements by size - Map monoid: counting occurences of elements in list - Recap: what we learned - Sneak peek of the Monoids and Semigroups libraries Read the code: github.com/kubukoz/videos/tree/master/monoids Previous videos: Traverse - youtube.com/watch?v=CSErp1mZodM Resource - youtube.com/watch?v=m9cu4xUvrUs Bracket - youtube.com/watch?v=vsJz-fdEsd4 Blocker - youtube.com/watch?v=v__IRT-QkwY Learn more about: - Monoid: typelevel.org/cats/typeclasses/monoid.html - Monoids beyond monoids - another talk by my friend Luka (Monoids, Monoids, Monoids): youtube.com/watch?v=DJyhWAwmGqE - monoids/semigroups libraries: github.com/ChristopherDavenport/monoids, github.com/ChristopherDavenport/semigroups - Monoids: Theme and Variations (Functional Pearl): repository.upenn.edu/cgi/viewcontent.cgi?article=1773&contex…What people say. Recommended as a clear and accessible introduction to monoids and semigroups in Scala.
u/kubukozcats,cats-effectin r/scala • Recommends