Control flow
val bracket : 'a -> ('a -> unit) -> ('a -> 'b) -> 'b
bracket resource destroy k
val wrapped : 'a -> ('a -> 'b) -> ('a -> unit) -> 'b
wrapped acc result k
Computation k
accumulates result into resource acc
which is guaranteed to be released at the end. Rarely useful (e.g. IO.output_string
)
File IO
Protected file IO, stdlib interface
val with_open_in_bin : string -> (Stdlib.in_channel -> 'a) -> 'a
val with_open_in_txt : string -> (Stdlib.in_channel -> 'a) -> 'a
val with_open_out_bin : string -> (Stdlib.out_channel -> 'a) -> 'a
val with_open_out_txt : string -> (Stdlib.out_channel -> 'a) -> 'a
val with_open_out_temp_file :
?temp_dir:string ->
mode:Stdlib.open_flag list ->
((string * Stdlib.out_channel) -> 'a) ->
'a
val with_open_out_temp_bin : ((string * Stdlib.out_channel) -> 'a) -> 'a
val with_open_out_temp_txt : ((string * Stdlib.out_channel) -> 'a) -> 'a
Protected file IO, extlib interface
val wrapped_output : 'a IO.output -> ('a IO.output -> unit) -> 'a
val wrapped_outs : (string IO.output -> unit) -> string
val with_output : unit IO.output -> (unit IO.output -> 'a) -> 'a
val with_output_bin : string -> (unit IO.output -> 'a) -> 'a
val with_output_txt : string -> (unit IO.output -> 'a) -> 'a
Misc.
val with_opendir : string -> (Unix.dir_handle -> 'b) -> 'b