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.

Fernando Cejas

May 05, 2022
Tweet

More Decks by Fernando Cejas

Other Decks in Technology

Transcript

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

    View full-size slide

  2. — Someone not Famous
    “The goal of Category theory is to show
    that trivial things are trivially trivial…”

    View full-size slide

  3. Some words about it…
    Category Theory
    01

    View full-size slide

  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

    View full-size slide

  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.

    View full-size slide

  6. Categories
    Map of the Middle Earth of the Lord of the Rings. Elves have made it.

    View full-size slide

  7. Functors
    Now another map of the Seven Kingdoms of Game of Thrones.

    View full-size slide

  8. Functors… and transform
    01
    02
    03
    04

    View full-size slide

  9. Monads
    Now another map of the Middle Earth, but this time, drawn by a Dwarf.

    View full-size slide

  10. 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)

    View full-size slide

  11. A Monad? WTF? 02
    From a Functional Programming perspective…

    View full-size slide

  12. MONAD: a bubble that
    encapsulates a computation
    that supports 2 main functions:
    map()
    flatMap()

    View full-size slide

  13. Tiny
    demo
    We are not fully aware on how
    much nowadays we use
    monadic types. They are all
    over the place!

    View full-size slide

  14. 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/

    View full-size slide