In terms that an OOP programmer would understand (without any functional programming background), what is a monad?

Technology CommunityCategory: OOPIn terms that an OOP programmer would understand (without any functional programming background), what is a monad?
VietMX Staff asked 3 years ago

A monad is an “amplifier” of types that obeys certain rules and which has certain operations provided.

First, what is an “amplifier of types”? By that I mean some system which lets you take a type and turn it into a more special type. For example, in C# consider Nullable<T>. This is an amplifier of types. It lets you take a type, say int, and add a new capability to that type, namely, that now it can be null when it couldn’t before.

As a second example, consider IEnumerable<T>. It is an amplifier of types. It lets you take a type, say, string, and add a new capability to that type, namely, that you can now make a sequence of strings out of any number of single strings.