-
It surprised me that nesting two effect handlers let one of the effects leak... (I have no certainty that my terminology here or interpretation of what is really happening is correct, hence in Q&A section!)... My goal is to write a unit test that has a mutable vector and uses random numbers. Each of those two things work separately for me. When I combine them, I get
and I have no idea how to wrap the main function in a handler. I found a workaround, but I don't understand it. This fails:
This fails:
This works!?:
Full test code is here |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think your type signature for |
Beta Was this translation helpful? Give feedback.
-
Thanks, Anton! That fixes it. I was confused by the error message. |
Beta Was this translation helpful? Give feedback.
I think your type signature for
istate-test
is wrong:fun istate-test(): <exn,div,random,istate<int>> string
still has the
istate
effect. I think if you remove that effect from the type signature you should be fine.In particular, if you add an effect to the type signature that is not needed in the function, Koka will subsequently assume that the function needed the effect.