let connect _ r w =
let eval req =
Writer.write_sexp w req
in
eval (Request.(sexp_of_t (Succ 42)));
eval (Request.(sexp_of_t (Neg (-42))));
eval (Request.(sexp_of_t (Plus (40, 2))));
eval (Request.(sexp_of_t (Sub (44, 2))));
eval (Request.(sexp_of_t (Times (6, 7))));
eval (Request.(sexp_of_t (Eq (42, 42))));
Reader.read_sexp r >>= fun res -> print_endline (or_else res "Eof");
Reader.read_sexp r >>= fun res -> print_endline (or_else res "Eof");
Reader.read_sexp r >>= fun res -> print_endline (or_else res "Eof");
Reader.read_sexp r >>= fun res -> print_endline (or_else res "Eof");
Reader.read_sexp r >>= fun res -> print_endline (or_else res "Eof");
Reader.read_sexp r >>| fun res -> print_endline (or_else res "Eof")