Module Prime_io
Helpers for standard library channels.
val with_file_in : (Stdlib.in_channel -> 'a) -> string -> 'awith_file_in f fpisf icwhereicis a channel opened for input from the file atfp.icis closed whenfreturns or raises an exception.
val with_file_out : (Stdlib.out_channel -> 'a) -> string -> 'awith_file_out f fpcallsf ocwhereocis a channel opened for output tofp.ocis closed whenfreturns or raises an exception. In the latter case the file is also removed.
val with1_file_in : (Stdlib.in_channel -> 'a -> 'b) -> string -> 'a -> 'bwith1_file_in f fp accisf ic accwhereicis a channel opened for reading fromfpduring the call. Due to the effect involved, this is not a special case ofwith_file_in.
val with1_file_out : (Stdlib.out_channel -> 'a -> 'b) -> string -> 'a -> 'bwith1_file_out f fp accisf oc accwhereocis a channel opened for writing tofpduring the call. Due to the effect involved, this is not a special case ofwith_file_out.
val fold_input : ?close:bool -> (Stdlib.in_channel -> 'a -> 'a) -> Stdlib.in_channel -> 'a -> 'afold_input f icforms the composition of successive calls tof icuntilEnd_of_fileis raised.- parameter close
If true, close
icbefore returning, including if an exception occurs while evaluatingf ic accfor someacc.