I am new to both category theory and Haskell.
It is well known that, in category theory, Monad can be defined as "a monoid in the category of endofunctors". According to the definition of Monoid in Wikipedia:
But according to the Monad laws in Haskell Wiki, a monad needs to follow three rules:
I think I can roughly understand how the unitor diagram in the definition of Monoid can be expressed as the left identity law and right identity law of Monad in Haskell. But I am not sure how I can infer the associativity law in Haskell only using the definition of Monoid?
EDIT:
I found this page, which states a different set of Monad laws and proves that from these four laws, we can get the three Monad laws in the Haskell Wiki. IMHO, the first law here can be inferred from the pentagon diagram and the second can be inferred from the unitor diagram in the definition of monoid. But I am not sure what are the equivalent definitions in Monoid that translates to the third and fourth laws.


(>>=)doesn't even make sense for an arbitrary monad. You need a strong monad to define(>>=). Either way,(>>=)is not the analogue of $\mu$,joinis. – Derek Elkins left SE May 24 '19 at 08:01(>>=)based onjoinandfmap, can we generalize it to category theory since Monad is indeed an (endo)functor? – Lifu Huang May 24 '19 at 08:09But since we may always think of a monoid as the homset of a category with a single object, where the binary operation is inherited from composition of morphisms, then the monoid just inherits associativity from the associativity of the morphism composition in the category. (Likewise, the identity law comes from the identity morphism.)
– Jack Crawford May 24 '19 at 09:46