204
you are viewing a single comment's thread
view the rest of the comments
[-] expr@programming.dev 7 points 1 year ago* (last edited 1 year ago)

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.

this post was submitted on 02 Jul 2023
204 points (100.0% liked)

Programmer Humor

19817 readers
78 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

founded 2 years ago
MODERATORS