package catala
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=6dbbc2f50c23693f26ab6f048e78172f
sha512=a5701e14932d8a866e2aa3731f76df85ff2a68b4fa943fd510c535913573274d66eaec1ae6fcae17f20b475876048a9ab196ef6d8c23d4ea6b90b986aa0a6daa
doc/catala.utils/Utils/File/index.html
Module Utils.FileSource
Utility functions used for file manipulation.
Runs the given function with the provided file opened, ensuring it is properly closed afterwards. May raise just as open_out.
Runs the given function with the provided file opened, ensuring it is properly closed afterwards. May raise just as open_in.
Formatter wrappers
with_formatter_of_out_channel oc f creates an flushes the formatter used in f from the given out_channel oc.
with_formatter_of_file filename f manages the formatter created from the file filename used in f -- i.e. closes the corresponding out_channel and flushes the formatter.
with_formatter_of_opt_file filename_opt f manages the formatter created from the file filename_opt if there is some (see with_formatter_of_file), otherwise, uses the Format.std_formatter.
val get_out_channel :
source_file:Pos.input_file ->
output_file:string option ->
?ext:string ->
unit ->
string option * ((out_channel -> 'a) -> 'a)get_output ~source_file ~output_file ?ext () returns the infered filename and its corresponding with_out_channel function. If the output_file is equal to Some "-" returns a wrapper around stdout.
val get_formatter_of_out_channel :
source_file:Pos.input_file ->
output_file:string option ->
?ext:string ->
unit ->
string option * ((Format.formatter -> 'a) -> 'a)get_output_format ~source_file ~output_file ?ext () returns the infered filename and its corresponding with_formatter_of_out_channel function. If the output_file is equal to Some "-" returns a wrapper around stdout.