What is a Monad?
What is a Monad? ================ Note: this article assumes some familiarity with Haskell. A monad is a monoid in the category of endofunctors. That's usually given as a joke answer, but it's true. And I think it's the proper way to explain what monads are and why they're useful. First, let's go over what a monoid is. A monoid has three components: - A category - An associative binary operation on that category - An "identity value" for the operation The easiest example is addition on the natural numbers. Here, the identity value is 0, because adding 0 to any number does not change it. Also note that addition is an associative operation; that is, (1 + 2) + 3 = 1 + (2 + 3). Similarly, multiplication is a monoid with identity value 1. However, we can easily show that subtraction and division are not monoids, because they are not associative: (1 - 2) - 3 ≠ 1 - (2 - 3). Given this definition, we can easily construct our own monoid. For example, our category could be shopping lists
What is a Monad? What is a Monad? ================ Note: this article assumes some familiarity with Haskell. A monad is a monoid in the category of endofunctors. That's usually given as a joke answer, but it's true. And I think it's the proper way to explain what monads are and why they're useful. First, let's go over what a monoid is. A monoid has three components: - A category - An associative binary operation on that category - An "identity value" for the operation The easiest example is addition on the natural numbers. Here, the identity value is 0, because adding 0 to any number does not
Explore this link on the map →saved by
related reading
- Monoids without tears | F# for fun and profitfsharpforfunandprofit.com
- What is Category Theory Anyway?math3ma.com
- Abstraction, intuition, and the “monad tutorial fallacy” | blog :: Brent -> [String]byorgey.wordpress.com
- Typeclassopedia - HaskellWikiwiki.haskell.org
- Category Theory on Math3mamath3ma.com
- Bartosz Milewski's Programming Cafe | Category Theory, Haskell, Concurrency, C++bartoszmilewski.com
- Natural Transformations | Bartosz Milewski's Programming Cafebartoszmilewski.com
- Categories, What's the Point? || Math ∩ Programmingjeremykun.com
- Kleisli Categories | Bartosz Milewski's Programming Cafebartoszmilewski.com
- Adjunctions | Bartosz Milewski's Programming Cafebartoszmilewski.com
- adventures in uncertainty: An Introduction to Recursion Schemesblog.sumtypeofway.com
- Monads and Macrosjohndcook.com