Skip to content

Commit

Permalink
use shift0. add operators for direct/read
Browse files Browse the repository at this point in the history
  • Loading branch information
duckpilot committed Sep 24, 2010
1 parent 592da5c commit 75c421b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/froc-direct/froc_direct.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ let read t =
| Some p -> p in
active_prompt := None;

Delimcc.take_subcont p begin fun sk () ->
Froc.notify_result_b t begin fun r ->
Delimcc.shift0 p begin fun k ->
Froc.notify_result_b t begin fun _ ->
active_prompt := Some p;
Delimcc.push_delim_subcont sk begin fun () ->
match r with
| Froc.Value v -> v
| Froc.Fail e -> raise e
end
k ()
end
end
end;
Froc.sample t

let (~|) = direct
let (~.) = read
3 changes: 3 additions & 0 deletions src/froc-direct/froc_direct.mli
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
val direct : (unit -> 'a) -> 'a Froc.behavior
val read : 'a Froc.behavior -> 'a

val (~|) : (unit -> 'a) -> 'a Froc.behavior
val (~.) : 'a Froc.behavior -> 'a

0 comments on commit 75c421b

Please sign in to comment.