summaryrefslogtreecommitdiff
path: root/src/kahn_seq.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-05-20 11:14:01 +0200
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-05-20 11:14:01 +0200
commitc5e69a904e79e807c5b075c08ce82183133e7b4c (patch)
tree4e629a9c2b653660dc438f1c37d58e8fbf3870d6 /src/kahn_seq.ml
parentacfa0090d68a21be6c83815f484142b4eb814f4a (diff)
downloadSystemeReseaux-Projet-c5e69a904e79e807c5b075c08ce82183133e7b4c.tar.gz
SystemeReseaux-Projet-c5e69a904e79e807c5b075c08ce82183133e7b4c.zip
Stuff.
Diffstat (limited to 'src/kahn_seq.ml')
-rw-r--r--src/kahn_seq.ml15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/kahn_seq.ml b/src/kahn_seq.ml
index 7f0eec5..ce82117 100644
--- a/src/kahn_seq.ml
+++ b/src/kahn_seq.ml
@@ -14,7 +14,7 @@ module Seq: S = struct
let push_cont (cont : ('a -> unit) option) (v : 'a) =
match cont with
| None -> ()
- | Some cont -> Queue.push (fun () -> cont v) tasks
+ | Some cont_f -> Queue.push (fun () -> cont_f v) tasks
let new_channel () =
let q = Queue.create () in
@@ -23,9 +23,7 @@ module Seq: S = struct
let put x c =
fun cont ->
Queue.push x c;
- match cont with
- | None -> ()
- | Some cont -> Queue.push cont tasks
+ push_cont cont ()
let rec get c =
fun cont ->
@@ -62,12 +60,11 @@ module Seq: S = struct
fun cont ->
push_cont cont v
- let bind e f =
- fun cont ->
- Queue.push (fun () -> e (Some (fun r -> f r cont))) tasks
- let bind_io e f =
+ let bind (e : 'a process) (f : 'a -> 'b process) : 'b process =
fun cont ->
- Queue.push (fun () -> e (Some (fun r -> f r cont))) tasks
+ e (Some (fun (r : 'a) -> f r cont))
+
+ let bind_io = bind
let run e =
let ret = ref None in