Thank you for the thought provoking discussion. I mulled over it a bit more. In the end it comes down to this for me: You have two functions f
and g
from ()
to String
. One can suspend (say for an external event), the other cannot. Do you want to distinguish the two function’s types?
Here’s a reason why you would want that: Your main thread can call f
directly. But calling g
means that your mean thread might suspend for a long time, in which case it cannot deal with other events. That’s a bad idea obviously. So, we want to know about whether a function can suspend (or take otherwise a long time to run) or not. As Eric Meijer says: Delay is an effect.
Now, should this info be part of the function’s type, or just be commented somewhere? There’s a tradeoff that depends on what the cost of keeping track of this info is. If we can lower the notational overhead, we can shift the tradeoff towards tracking more things in types. That’s what our project is about.