Stuck in interleavedx
from the structured async paper
#639
-
I'm trying to port the code from the Structured Asynchrony with Algebraic Effects, but I'm unable to port the So far I have this:
The problem is in
I don't understand why the expected type doesn't have Lines 415 to 416 in a7c4292 What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I managed to make it work:
But I still don't understand why I need to add the
How can a variable read use |
Beta Was this translation helpful? Give feedback.
-
Divergence analysis is very basic in Koka, and very conservative. See this paper, section 2.7 for the particular reasons why divergence is inferred here: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/koka-effects-2013.pdf. TLDR; heaps can store cyclic references that could cause divergence. Although this does not happen for non-function types, since the return value is polymorphic we cannot make guarantees. You can of course try arguing specific cases, such as if you aren't calling a heap-read value, but how is that knowledge of the fact that a function came from a heap propagated to a polymorphic return value? You would need a flow sensitive analysis to get more precision in the types. I'm not 100% certain of all the details here, but at least I know the paper to read :). |
Beta Was this translation helpful? Give feedback.
Divergence analysis is very basic in Koka, and very conservative. See this paper, section 2.7 for the particular reasons why divergence is inferred here: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/koka-effects-2013.pdf.
TLDR; heaps can store cyclic references that could cause divergence. Although this does not happen for non-function types, since the return value is polymorphic we cannot make guarantees. You can of course try arguing specific cases, such as if you aren't calling a heap-read value, but how is that knowledge of the fact that a function came from a heap propagated to a polymorphic return value? You would need a flow sensitive analysis to get more pre…