Parameter Make.IO

type 'a t
val return : 'a -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val bind : ('a -> 'b t) -> 'a t -> 'b t

Interactions may raise exceptions:

val fail : exn -> 'a t
val catch : (unit -> 'a t) -> (exn -> 'a t option) -> 'a t

catch f handle runs f () and, if it raises an exception e such that handle e returns Some k, continues with k. Otherwise the exception propagates untouched.

val protect : finally:(unit -> unit t) -> (unit -> 'a t) -> 'a t

protect ~finally f runs f (), then finally () whether f succeeded, raised an exception or was cancelled. If finally raises, its exception replaces the one from f.

The following HTTP methods are required:

val get : string -> string t

get url returns the body of the response.

val post : string -> string -> string t

post url body returns the body of the response. The Content-Type header should be application/json.

val delete : string -> string t

delete url returns the body of the response.