News for hackers. Stuff that matters.
Re:Functional programming jargon in plain English by pdpi on Monday July 04, 2022 @10:27AM (#31977395)
This is one of those things where looking at the type signature hard enough eventually gives the game away, but most writing on it sucks:

    bind :: m a -> (a -> m b) -> m b
Because that function in the middle takes an `a`, your implementation of `bind` needs to be able to take an `m a` and pull an `a` out of it, which means it also has to evaluate however much of `m` is needed to actually get to that `a`.

Because that function in the middle returns an `m b`, binding again with a function `b -> m c` requires you to pull `b` out of `m b`, which in turn forces pulling an `a` out of `m a` to make progress. This is where you force sequentiality — you can only evaluate the `m` in `m b` after you've evaluated the `m` in `m a`

Re:Functional programming jargon in plain English by skybrian on Monday July 04, 2022 @12:20PM (#31978744)
Caveat: there is the trivial case of calling the middle function zero times. Which does happen (in the case of a Maybe type) but presumably any useful code needs to be able to call the function sometimes.
Re:Functional programming jargon in plain English by samiskin on Monday July 04, 2022 @12:54PM (#31979161)
This makes a lot more sense than anything I've read about this in the past, thanks for the explanation!
Re:Functional programming jargon in plain English by pdpi on Monday July 04, 2022 @01:05PM (#31979308)
Thanks, that's reassuring. I've long been frustrated by just how bad monad posts are in general, and been meaning to write something up about it that makes it clearer. It's good to know that I'm at least going in the right direction :)