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 :)
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`