It feels like anything is mowed down on the internet. I’ve been a dev for a long time too, and I never feel sure when I chose a stack for a new toy project (in my day job I rarely get to chose, so that’s a non issue there)

  • alr@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    10 months ago

    If you use JavaScript, you’ve probably seen a monad, since Promise is a monad. Unit is Promise.resolve(), bind is Promise.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), and x.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.