Conversation started Jan 16, 2014 at 13:50.
Jan 16, 2014 13:50
guys, I was wondering
Good thing you stopped.
@CatPlusPlus false. Not everyone dies of old age
some die from cancer
or AIDs
@R.MartinhoFernandes paused. I need a clarification on something
@R.MartinhoFernandes Would be better if he said "thinking"
Jan 16, 2014 13:51
@BartekBanachewicz you are probably wrong.
@thecoshman I want to know why
@BartekBanachewicz vOv you
With the information given, the best we can say is "because you suck" :P
@R.MartinhoFernandes information aside, we can always say that.
Jan 16, 2014 13:52
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?
Assuming pB is something like queryResult + aResult (IOW it doesn't need result of A to do it's query, only to produce the final result)
@BartekBanachewicz you mean to say pB makes it own request?
@thecoshman yes, they both do. pB just takes an additional value parameter
add in a pC that combines pA and pB?
Jan 16, 2014 13:54
which is extracted from pA with >>=, obviously
Just say that they can run concurrently?
Not sure what you're asking.
@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
Would that be an ok solution?
@BartekBanachewicz Isn't that the opposite of the previous scenario?
@thecoshman hmm which one?
oh, groin
hehe
so... you want pB to both be able to run in parallel, but also not run in parallel?
Jan 16, 2014 13:57
@AndyProwl The question is essentially "how to distinguish between the two needs"
@LightnessRacesinOrbit meh, spelling :P
@thecoshman I want to be able to express either of them.
@BartekBanachewicz well you have to chose which you want to express, how can it make sense otherwise?
@BartekBanachewicz I see. So it's about vocabulary here, you're not talking about how to realize such a thing or prevent it, right?
@AndyProwl pretty much, yes.
Jan 16, 2014 13:58
either you can run pA and pB at the same time, or pB has to wait until pA has finished.
@thecoshman And once I choose, how do I express that?
You can make pB's parameter strict, I guess.
@BartekBanachewicz I have no idea :P You are using crazy symbols
@R.MartinhoFernandes elaborate please.
@thecoshman I explicitely said it's a monadic Promise on the beginning -.-
Actually, \x -> case x of { Nothing -> whatever; Just y -> y + queryB } should do that job fine.
The dependency is implicit there.
Jan 16, 2014 13:59
@BartekBanachewicz ... of which I know nothing clearly ಠ_ಠ
But in general it seems to me this problem is not related specifically to monadic functions, or is it?
Can't we just apply the same distinction to regular functions?
@AndyProwl that depends on the evaluation strategy, I think.
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.
(modulo side-effects of course)
if you use full beta-reduction, you need to say that explicitely. Under call-by-value evaluation, you don't.
I don't see the problem.
Unless you want to create an artificial dependency, in which case you can use seq.
Jan 16, 2014 14:02
@R.MartinhoFernandes I think Bartek is mostly interested in how to name these evaluation strategies - whether there is some established convention or not.
@R.MartinhoFernandes I see. So seq would act like that "sync point".
All other cases will have a data dependency in them that will get you the right order of evaluation.
@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 see. I do not know much about it so I can't give an advice, but I wanted to understand what you were asking :)
But it still seems to me that it's not a distinction specific to monadic functions.
Jan 16, 2014 14:06
@AndyProwl take a look
Thinking about it... a retail job sounds rather nice. You just do your work, then go home.
@R.MartinhoFernandes I see. Thanks for explanation, I think I get it.
This book is great BTW, gives me much deeper understanding of what's going on.
@BartekBanachewicz What book?
@AndyProwl Types and Programming Languages
@BartekBanachewicz Ah, I just bought it!
Jan 16, 2014 14:08
@AndyProwl oh cool. Then it's page 56.
@Bartek Amazon asked me to review it.
Still waiting for it though
@R.MartinhoFernandes lel.
@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.
Jan 16, 2014 14:10
You could buy it printed already! whistles
I did!
2 mins ago, by Andy Prowl
Still waiting for it though
Wow, to think that once I too was of the mindset where I would buy programming books.
@TonyTheLion Thanks! That's exactly what I needed!
@thecoshman That's OK, it probably means you're healthy.
@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.
Jan 16, 2014 14:14
@AndyProwl nah I just don't care
Still, it's the idea that matters.
 
Conversation ended Jan 16, 2014 at 14:14.