For the past two days I have been on a question to understand monads in the context of Haskell. A nice explanation I found is by Graham Hutton on the Computerphile channel see here. This explanation has also been paraphrased into this nice answer on stackoverflow. It makes more or less perfect sense to me, but I am having difficulty matching this to the mathematical definition of a monad which I found nicely explained in this video, quoting the final part:

A monad in X is a monoid in the category of endofunctors of X

So, far I know the category we are dealing with is the category Hask,

The main category we'll be concerning ourselves with in this article is Hask, which treats Haskell types as objects and Haskell functions as morphisms and uses (.) for composition: a function f :: A -> B for types A and B is a morphism in Hask.- Wikibooks

Wikipedia defines monoid as a set with a binary operation having identity and associativity, but I am failing to see how to use that definition to understand what's going on here.

Now, I've seen this post here on CS SE by Andrej Bauer that we have to do a little work to get the equivalence, but could someone anyways try explaining the above in less abstract/ concrete terms for a total newb to understand?

  • 1
    $\begingroup$ Are you familiar with the definition of a monoid in a category? The definition you mention is the standard one from abstract algebra, but categorically speaking we would say that it's specialized to the category of sets. See here for a categorically minded discussion of the definition you mention, and here for a discussion of the more categorical version. (generally speaking, nlab>wikipedia for category theory references) $\endgroup$
    – Alec Rhea
    Jul 1 at 2:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.