Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4ea614c31c
Fetching contributors…

Cannot retrieve contributors at this time

57 lines (43 sloc) 1.637 kb
Copyright © 2011 MLstate
This file is part of OPA.
OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.
OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.
You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <>.
@author Louis Gesbert
(** This module contains common types, functions and helpers used throughout the
badop interface and implementations ; it's a generic lib, all specific stuff
is in *)
type ('which, 'q, 'r) dialog =
| Query of 'q
| Response of 'r
module Dialog = struct
type query
type response
type ('which, 'q, 'r) t = ('which, 'q, 'r) dialog =
| Query of 'q
| Response of 'r
let query q = Query q
let response = function
| Response r -> r
| Query _ -> assert false (* guaranteed not to happen by the phantom type *)
module Dialog_aux = struct
open Cps.Ops
let respond _ r = Response r
let map_dialog ~query ~response dialog k = match dialog with
| Query q -> query q @> fun q -> Query q |> k
| Response r -> response r @> fun r -> Response r |> k
(* WARNING: unsafe, ONLY for use in de-serialisation functions *)
let make_unsafe_query q = Query q
let make_unsafe_response r = Response r
Jump to Line
Something went wrong with that request. Please try again.