Fix dynamic_state to use new Effect syntax, could possibly be simplified further. The type checking inside the effect handlers is a bit fragile, if you reorder the matches in run or run2 they no longer type check.
version 1 fails with Exception: Stdlib.Effect.Unhandled(LocalState(R).New(1))
version 2 passed with int = 5
version 3 I couldn't work out how to run it properly.
version 4 passed producing 3 3
Fix dynamic_state to use new Effect syntax, could possibly be simplified further. The type checking inside the effect handlers is a bit fragile, if you reorder the matches in
run
orrun2
they no longer type check.version 1 fails with
Exception: Stdlib.Effect.Unhandled(LocalState(R).New(1))
version 2 passed withint = 5
version 3 I couldn't work out how to run it properly. version 4 passed producing3 3