let pipe_pub_sub () : unit Deferred.t =
let open PubSub in
let ps = create () in
don't_wait_for (pub ps "negative one");
let r0 = sub ps in
don't_wait_for (pub ps "zero");
let r1 = sub ps in
don't_wait_for (pub ps "one");
let r2 = sub ps in
don't_wait_for (pub ps "two");
let r3 = sub ps in
close ps;
let subs = [r0; r1; r2; r3] in
Deferred.List.iteri subs ~f:(fun i r -> Pipe.iter r ~f:(fun x -> return (printf "%d: %s\n" i x)))