
On 3/07/2015 08:54, Andrzej Krzemienski wrote:
A mongel monad has three states. But there are many things out there that have three states, and it does not mean they have to be mapped on a tribool type. For instance, a file can be empty or can contain some data or be non-existent. But why would I ever think of mapping it onto a tribool?
This instantly reminded me of this: http://thedailywtf.com/articles/What_Is_Truth_0x3f_
The reason people choose to use Boolean values is because at some point they need Boolean arithmetic. Unless I am missing something, you need not exercise the Boolean algebra on the state of the result of the asynchronous operation. It seams that the conceptual mapping of the state of the monad onto a Boolean type brings no value to the programmers that will be launching asynchronous tasks.
I can see some logic in the mapping {has_value() => true, has_error/exception() => false, !ready() => indeterminate}. However from the sounds of it this is not the mapping that is in the current code (I haven't looked too closely). I can also see some reasonable argument for {ready() => true, !ready() => false}, with no third possibility. (In terms of boolean arithmetic, both of the above are still potentially useful if eg. a bit of code wants to test if three futures are all ready [without waiting for them] it could use a && b && c... but the brevity could be confusing if you don't know *which* of those mappings were used.) For the avoidance of confusion, I'm inclined to agree with Andrzej, that at least initially it's probably better not to attempt to provide any sort of bool/tribool implicit mapping, and force the user to be explicit about what question they're asking. Such things can be added later if it turns out that there is a clear consensus on what it should actually mean.