Combining callback effects in the return type? #628
-
Output:
Shouldn't I'm also not sure why I need a
Is this expected? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I realized that the error is actually that I'm trying to update the
Which is not right, as the return type should include effects of both
What is the syntax for "div + next-fx + cb-fx" in the return type of |
Beta Was this translation helpful? Give feedback.
-
These are the changes to get it working.
The effect variable after the vertical bar needs to be the same in all callbacks and the return type. Also The reason it needs to be the same in all is that it needs to unify to the least upper bound of both callback's extra effects. For example if Due to similar reasoning the same goes for all the explicit effects in the callback type signatures when they have an effect variable. In this case this is only For functions that are not polymorphic in the effect type, you can have different types in the callback functions because koka already knows that next / cb will not use any additional effects, so it doesn't need to worry about a cb being passed in that uses a state effect and whether it is the same state effect that next uses:
I haven't really encountered any situations where I need one function parameter to be polymorphic in effect and the other not. As far as the reason for
|
Beta Was this translation helpful? Give feedback.
These are the changes to get it working.
The effect variable after the vertical bar needs to be the same in all callbacks and the return type. Also
<extra-fx>
treats it as a label (specific effec…