#readwise # Monoids, Semigroups, and Friends ![rw-book-cover](https://readwise-assets.s3.amazonaws.com/static/images/article2.74d541386bbf.png) ## Metadata - Author: [[Mark Seemann]] - Full Title: Monoids, Semigroups, and Friends - URL: https://blog.ploeh.dk/2017/10/05/monoids-semigroups-and-friends/ ## Summary Monoids, Semigroups, and Friends is blog series that covers magmas. Here's a list of articles that belong to this series, retrieved on March 17, 2023: - [[Monoids]] - [[Semigroups]] - [[Quasigroups]] - [[Magmas]] ## Highlights - **Functional programming has often been criticised for its abstruse jargon.** Terminology like zygohistomorphic prepromorphism doesn't help sell the message, but **before we start throwing stones, we should first exit our own glass house. In object-oriented design, we have names like Bridge, Visitor, SOLID, cohesion, and so on. The words sound familiar, but can you actually explain or implement the Visitor design pattern, or characterise cohesion?** - **In Domain-Driven Design, Eric Evans discusses the notion of Closure of Operations**, that is, operations "whose return type is the same as the type of its argument(s)." In C#, it could be a method with the signature `public Foo Bar(Foo f1, Foo f2`). This method takes two Foo objects as input, and returns a new Foo object as output. **As Evans points out, object designs with that quality begins to look like arithmetic. If you have an operation that takes two Foo and returns a Foo, what could it be? Could it be like addition? Multiplication? Another mathematical operation? ... What Evans describes are monoids, semigroups, and similar concepts from abstract algebra.** - All magmas describe binary operations of the form: an operation takes two Foo values as input and returns a Foo value as output.