## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

# Monoids

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—`Int`, `Double`, `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 ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required