Assuming we have a monadic Promise in a chain pA >>= pB, in which pA makes an async query to the server, returns a value to pB which makes another query and combines the result... how to describe whether pB can start querying w/o waiting for pA's result?
doesn't make sense, didn't Alf purposely got banned from Stackoverflow, but now you are telling me he got some kind of old man disease ... but wouldn't it be discrimination that SO ban people who suffer from old man disease?
@R.MartinhoFernandes for example, the cost of pB query might be big on the server. If then pA returns Nothing, it effort goes to waste. How do I express that pB should always "sync" with previous promises before going further?
I imagine something like pA >>= strictWait >>= pB, for example
I mean, if I give as input to bar() the output of foo(), and bar() in the beginning does something that does not depend on the output of foo(), there is some potential for parallelism.
@R.MartinhoFernandes I think Bartek is mostly interested in how to name these evaluation strategies - whether there is some established convention or not.
@AndyProwl Well I was reading about lambda expression evaluation strategies yesterday, and as I said it looks similar to beta-reduction vs call-by-value. But I was interested on how you can practically look at that problem, too
@BartekBanachewicz seq merely makes the second value artificially depend on the first one. The rest is just a result of the nature of the language. If you already have a dependency (as my example with case of above) you don't need seq.
@BartekBanachewicz I have the PDF, but I hate reading books on my laptop. Yesterday before leaving the office I printed only the first 2 chapters for evening reading and today I'm sick so I can't get to print the next 2 chapters. Damn it.
@BartekBanachewicz FWIW, in practice that sort of means that seq evaluates the first argument before the second, but from a strict point of view, if the compiler could prove certain properties (which no compiler bothers with because high impracticality and low usefulness) about the arguments, it would be allowed do all sorts of different evaluation orders. There's pseq with stricter requirements on the part of the compiler, but I'm not sure what situations call for it.