Module Ecaml.Sync_or_async

type ('a, 'b) t =
| Sync : ('a'a) t
| Async : ('a'a Async_kernel.Deferred.t) t
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> ('b -> Ppx_sexp_conv_lib.Sexp.t) -> ('a'b) t -> Ppx_sexp_conv_lib.Sexp.t
val return : ('a'b) t -> 'a -> 'b
val protect : ?⁠allow_in_background:bool -> Core_kernel.Source_code_position.t -> (_'a) t -> f:(unit -> 'a) -> finally:(unit -> unit) -> 'a

See Background for the invariants that must be maintained when running an async job in the background.