this post was submitted on 02 Jul 2023
23 points (96.0% liked)
Programmer Humor
19589 readers
1835 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
JavaScript promises are not monads: https://stackoverflow.com/questions/45712106/why-are-promises-monads
They're close, but not quite.
then
can shift semantics from under you depending on what's supplied.It should also be added that monoids require the type to have an identity or "empty" value (which is the empty array for arrays).
The explanation is pretty off in general, since it implies that any type that's both a functor and a monoid is a monad, which is simply not true. A good example is a
ZipList
(like lists, but with an applicative instance based on zipping). It's a functor and a monoid, but definitely not a monad.