matijapretnar/eff

Loaded code and code displayed are different?

Closed this issue · 2 comments

In the Non-determinism example on the website, the backtrack handler code is written like this

let backtrack = handler
  | effect Decide k ->
    (* We use a second handler to handle the continuation. *)
    handle continue k false with
    | effect Fail _ -> continue k true
;;

However, it seems to me, that the paper defines it like follows

let backtrack = handler
  | effect Decide k ->
    (* We use a second handler to handle the continuation. *)
    handle continue k true with
    | effect Fail _ -> continue k false
;;

Notice that the continuations are reversed

When I try loading the code in the REPL, the handler behaves correctly (I believe), even though the code shown above the REPL is wrong.

I am not sure whether this is a misunderstanding on my side or a bug, but I would be appreciative if someone could take a look at it.

On a second look, I didn't notice that backtrack is overriden later in the code

Hmmm, the second definition was probably unintentional, so I removed it. Thanks!