55
What programming languages aren't too criticized here?
(lemmy.fbmac.net)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities !webdev@programming.dev
If you use JavaScript, you've probably seen a monad, since Promise is a monad. Unit is
Promise.resolve()
, bind isPromise.then()
. As required,Promise.resolve(x).then(y) === y(x)
(unit forms a left identity of bind),y.then(Promise.resolve) === y
(unit forms a right identity of bind), andx.then(y.then(z)) === x.then(y).then(z)
(bind is essentially associative).You even have the equivalent of Haskell's fancy do-notation (a form of syntactic sugar to save writing unit and bind all over the place) in the form of async/await. It's just not generalized the way it is in Haskell.