how to form a monoid

Last post explored a foundational concept in category theory, the monoid. Here are some simple but diverse examples from Functional Programming in Scala. This is a rubber meets the road type post and is probably only useful if you are newer to category theory, Scala or both.


The orElse method is pretty cool here it didn’t strike me as particularly useful initially but looking around one might use something like this for creating a purely functional configuration tool where a value might exist in two locations and only one is needed. Thats pretty much it for now hopefully that adds a little utility to the option monoid.