r/functionalprogramming • u/snowtigger • Dec 21 '22
JavaScript Explained in 5 minutes: Monads
https://piotrjaworski.medium.com/explained-in-5-minutes-monads-89d54d230baf
8
Upvotes
r/functionalprogramming • u/snowtigger • Dec 21 '22
11
u/beezeee Dec 22 '22
These are all functors as defined. You're missing join if you want a monad. So you've motivated functors here but no monads in sight
14
u/jeenajeena Dec 22 '22
Only, it’s about Functors, not Monads.
5
u/unqualified_redditor Dec 22 '22 edited Dec 22 '22
Many others have explained how this article doesn't actually talk about monads. I'd like to point out another problem in this article..
The author claims that all previous monad tutorials get hung up on category theory and don't start from motivating examples. The author lists as an example of this Phil Wadler's 1992 paper introducing monads to haskell.
However, the introduction section of this very paper states:
And the paper then goes on to describe concrete solutions to a bunch of common software engineering problems (Exceptions, State, Parsing, etc) and then shows how all these solutions can be generalized to the same basic form using the monadic bind operation.
Phil Wadler's original paper is the blog post this author tried to write.
EDIT: Also the "wrapper around a value" metaphor completely falls apart when you consider types like
Reader,State,Parser,Cont, etc.2
u/mw9676 Dec 22 '22
Commenting to follow.
2
u/yeastyboi Dec 21 '22
Wow, i finally understand monads! I have been using them for months, just didn't have a term to describe them (rust and ocaml options)