Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Monads...and Monads...

Monads...and Monads...

Just a tiny presentation trying to explain monadic types in 10 minutes by giving a bit of an overview of Mathematics Category Theory.

Bf72839b363012bc2c86cbf52d79e0f0?s=128

Fernando Cejas

May 05, 2022
Tweet

More Decks by Fernando Cejas

Other Decks in Technology

Transcript

  1. Monads…and Monads… In 10 minutes…???

  2. — Someone not Famous “The goal of Category theory is

    to show that trivial things are trivially trivial…”
  3. Some words about it… Category Theory 01

  4. Category Theory is a mathematical discipline with a wide range

    of applications in theoretical computer science. Concepts like Category, Functor, Monad, and others, which were originally defined in Category Theory, have become pivotal for the understanding of modern Functional Programming (FP) languages and paradigms. The meaning and applications of these terms in FP can be understood without in-depth knowledge of the corresponding mathematical definitions and axiomatic. However, a common knowledge of the underlying theory can help FP programmers understand the design and structure of commonly used libraries and tools and be more productive. Category Theory
  5. Whoa! • Categories • Monoids • Isomorphisms • Duality Principle

    • Functors Shamelessly taken from wikibooks of haskell Hask category treats Haskell types as objects and Haskell functions as morphisms and uses for composition ((\circ)) the function ((.)), a function (f :: A -> B) for types A and B is a morphism in Hask.
  6. Categories Map of the Middle Earth of the Lord of

    the Rings. Elves have made it.
  7. Functors Now another map of the Seven Kingdoms of Game

    of Thrones.
  8. Functors… and transform 01 02 03 04

  9. Whoa!

  10. Monads Now another map of the Middle Earth, but this

    time, drawn by a Dwarf.
  11. Monads If an endofunctor also fulfills that it has two

    natural transformations such as the identity function and another function that is associative, we can say that we have a monad (this we call monadic laws)
  12. A Monad? WTF? 02 From a Functional Programming perspective…

  13. MONAD: a bubble that encapsulates a computation that supports 2

    main functions: map() flatMap()
  14. Tiny demo We are not fully aware on how much

    nowadays we use monadic types. They are all over the place!
  15. CREDITS: This presentation template was created by Slidesgo, including icons

    by Flaticon, and infographics & images by Freepik Thanks! Do you have any questions? @fernando_cejas fernandocejas.com • https://dev.to/juaneto/knowing-monads-through-the-category-theory-1mea • https://ernestobossi.com/categories/monads/functors/introduction-catgories/ • https://nikgrozev.com/2016/03/14/functional-programming-and-category-theory-part-1-categories-and-functors/ • https://nikgrozev.com/2016/04/11/functional-programming-and-category-theory-part-2-applicative-functors/ • http://www.jeanfrancoisparadis.com/blog/2014/01/13/monads-in-10-minutes/