Skip to content

Commit

Permalink
Slight tweak to the return example.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhil committed Apr 9, 2024
1 parent 3753051 commit 3d1286a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/return.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ module Alg(D : sig type t end) : ALG with type t := D.t = struct
let open Effect.Deep in
let open Multicont.Deep in
let conts = ref [] in
let pop () =
let backup ans =
match !conts with
| cont :: conts' -> conts := conts'; cont
| _ -> assert false
| r :: conts' ->
conts := conts';
resume r (Done ans)
| _ -> ans
in
let push r =
conts := r :: !conts
in
{ retc = (fun ans -> ans)
; exnc =
(function
Return ans ->
let r = pop () in
resume r (Done ans)
Return ans -> backup ans
| e -> raise e)
; effc = (fun (type a) (eff : a Effect.t) ->
match eff with
Expand Down

0 comments on commit 3d1286a

Please sign in to comment.