All monoids, monads, and functors are derived from mathematics. One thing about this subject is that similarly to programming, it tries to find abstractions. If we try to map mathematics to programming, we can think about the different data types we have—
Long, or custom data types. Each type can be characterized by the operations it supports and the laws of these operations, and this is called the algebra of the type.
Now, if we think about it, we can identify the operations that are shared by multiple types, for example, addition, multiplication, subtraction, and so on. Different types can share the same operations and they can conform to exactly the same laws. This is something we can take advantage of because this allows ...