[Pp] Rename Pp.to_string

Summary:
Now that we have two similar functions, it becomes confusing, because `Pp.to_string` and `Pp.string_of_pp` can seem to do the same stuff, while in reality they do the opposite.

Well, it is still bit confusing, because the proper names would be
`Pp.pp_of_to_string` and `Pp.to_string_of_pp`, but I think this high
level order names are not necessary given that in most cases they will
be used as concrete functions.

I think `Pp.of_string` captures such usages better than `to_string` used to do: you need to pp stuff,
but you have a string (or, technically, a function that returns a string), so you pretty print OF that string, aren't you?

Reviewed By: jvillard

Differential Revision: D18245876

fbshipit-source-id: fd4b6ab68
master
Mitya Lyubarskiy 5 years ago committed by Facebook Github Bot
parent 688deb0936
commit 0c3e568fa4

@ -45,7 +45,7 @@ let rec pp fmt = function
| Darray (de1, de2) -> | Darray (de1, de2) ->
F.fprintf fmt "%a[%a]" pp de1 pp de2 F.fprintf fmt "%a[%a]" pp de1 pp de2
| Dbinop (op, de1, de2) -> | Dbinop (op, de1, de2) ->
F.fprintf fmt "(%a%a%a)" pp de1 (Pp.to_string ~f:(Binop.str Pp.text)) op pp de2 F.fprintf fmt "(%a%a%a)" pp de1 (Pp.of_string ~f:(Binop.str Pp.text)) op pp de2
| Dconst (Cfun pn) -> ( | Dconst (Cfun pn) -> (
match builtin_functions_to_string pn with match builtin_functions_to_string pn with
| Some str -> | Some str ->

@ -126,7 +126,7 @@ let pp f
F.fprintf f "@[<v>{ proc_name= %a@,; translation_unit= %a@," Typ.Procname.pp proc_name F.fprintf f "@[<v>{ proc_name= %a@,; translation_unit= %a@," Typ.Procname.pp proc_name
SourceFile.pp translation_unit ; SourceFile.pp translation_unit ;
if not (PredSymb.equal_access default.access access) then if not (PredSymb.equal_access default.access access) then
F.fprintf f "; access= %a@," (Pp.to_string ~f:PredSymb.string_of_access) access ; F.fprintf f "; access= %a@," (Pp.of_string ~f:PredSymb.string_of_access) access ;
if not ([%compare.equal: (Mangled.t * Typ.t) list] default.captured captured) then if not ([%compare.equal: (Mangled.t * Typ.t) list] default.captured captured) then
F.fprintf f "; captured= [@[%a@]]@," pp_parameters captured ; F.fprintf f "; captured= [@[%a@]]@," pp_parameters captured ;
if not ([%compare.equal: string list] default.exceptions exceptions) then if not ([%compare.equal: string list] default.exceptions exceptions) then
@ -158,7 +158,7 @@ let pp f
pp_bool_default ~default:default.is_variadic "is_variadic" is_variadic f () ; pp_bool_default ~default:default.is_variadic "is_variadic" is_variadic f () ;
if not (ClangMethodKind.equal default.clang_method_kind clang_method_kind) then if not (ClangMethodKind.equal default.clang_method_kind clang_method_kind) then
F.fprintf f "; clang_method_kind= %a@," F.fprintf f "; clang_method_kind= %a@,"
(Pp.to_string ~f:ClangMethodKind.to_string) (Pp.of_string ~f:ClangMethodKind.to_string)
clang_method_kind ; clang_method_kind ;
if not (Location.equal default.loc loc) then F.fprintf f "; loc= %a@," Location.pp_file_pos loc ; if not (Location.equal default.loc loc) then F.fprintf f "; loc= %a@," Location.pp_file_pos loc ;
F.fprintf f "; locals= [@[%a@]]@," (Pp.semicolon_seq ~print_env:Pp.text_break pp_var_data) locals ; F.fprintf f "; locals= [@[%a@]]@," (Pp.semicolon_seq ~print_env:Pp.text_break pp_var_data) locals ;

@ -588,7 +588,7 @@ let has_init_list_const_expr an =
in in
L.(debug Analysis Verbose) L.(debug Analysis Verbose)
"@\n\n[has_init_list_const_expr] EVALUATE EXP '%a' result = '%b'@\n" "@\n\n[has_init_list_const_expr] EVALUATE EXP '%a' result = '%b'@\n"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
exp res ; exp res ;
res res
in in

@ -86,7 +86,7 @@ module JsonFragment = struct
| _ -> | _ ->
L.die InternalError "Unexpected json fragment \"%s\" in state [%a]" L.die InternalError "Unexpected json fragment \"%s\" in state [%a]"
(to_string json_fragment) (to_string json_fragment)
(Pp.seq (Pp.to_string ~f:string_of_state)) (Pp.seq (Pp.of_string ~f:string_of_state))
!pp_state !pp_state
@ -102,7 +102,7 @@ module JsonFragment = struct
| _ -> | _ ->
L.die InternalError "Unexpected assoc field \"%t\" in state [%a]" L.die InternalError "Unexpected assoc field \"%t\" in state [%a]"
(fun f -> Json.pp_field pp_value f key value) (fun f -> Json.pp_field pp_value f key value)
(Pp.seq (Pp.to_string ~f:string_of_state)) (Pp.seq (Pp.of_string ~f:string_of_state))
!pp_state !pp_state
end end

@ -176,5 +176,5 @@ let pp_checker fmt {name; callbacks} =
|> LanguageSet.elements |> LanguageSet.elements
in in
F.fprintf fmt "%s (%a)" name F.fprintf fmt "%s (%a)" name
(Pp.seq ~sep:", " (Pp.to_string ~f:Language.to_string)) (Pp.seq ~sep:", " (Pp.of_string ~f:Language.to_string))
langs_of_callbacks langs_of_callbacks

@ -26,7 +26,7 @@ let add switch_case = current_cases := switch_case :: !current_cases
let pp_condition fmt = function let pp_condition fmt = function
| Case stmt -> | Case stmt ->
F.fprintf fmt "case %a:" (Pp.to_string ~f:Clang_ast_j.string_of_stmt) stmt F.fprintf fmt "case %a:" (Pp.of_string ~f:Clang_ast_j.string_of_stmt) stmt
| Default -> | Default ->
F.pp_print_string fmt "default:" F.pp_print_string fmt "default:"

@ -167,7 +167,7 @@ let make_next_object_exp stmt_info item items =
| _ -> | _ ->
CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range
"unexpected item %a" "unexpected item %a"
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) (Pp.of_string ~f:Clang_ast_j.string_of_stmt)
item ) item )
in in
let var_decl_ref, var_type = get_decl_ref item in let var_decl_ref, var_type = get_decl_ref item in

@ -62,7 +62,7 @@ let binary_operation_instruction source_range boi ((e1, t1) as e1_with_typ) typ
| `PtrMemD | `PtrMemI -> | `PtrMemD | `PtrMemI ->
CFrontend_errors.unimplemented __POS__ source_range CFrontend_errors.unimplemented __POS__ source_range
"Pointer-to-member constructs are unsupported. Got '%a'." "Pointer-to-member constructs are unsupported. Got '%a'."
(Pp.to_string ~f:Clang_ast_j.string_of_binary_operator_info) (Pp.of_string ~f:Clang_ast_j.string_of_binary_operator_info)
boi boi
| `Add -> | `Add ->
if Typ.is_pointer t1 then (binop_exp Binop.PlusPI, []) if Typ.is_pointer t1 then (binop_exp Binop.PlusPI, [])

@ -424,7 +424,7 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
~recover:(fun () -> ()) ~recover:(fun () -> ())
~pp_context:(fun fmt () -> ~pp_context:(fun fmt () ->
F.fprintf fmt "Error adding types from decl '%a'" F.fprintf fmt "Error adding types from decl '%a'"
(Pp.to_string ~f:Clang_ast_j.string_of_decl) (Pp.of_string ~f:Clang_ast_j.string_of_decl)
dec ) dec )
trans_unit_ctx ; trans_unit_ctx ;
List.iter ~f:translate method_decls List.iter ~f:translate method_decls

@ -89,9 +89,9 @@ let get_var_name_mangled decl_info name_info var_decl_info =
| "", None -> | "", None ->
CFrontend_errors.incorrect_assumption __POS__ decl_info.Clang_ast_t.di_source_range CFrontend_errors.incorrect_assumption __POS__ decl_info.Clang_ast_t.di_source_range
"Got both empty clang_name and None for param_idx in get_var_name_mangled (%a) (%a)" "Got both empty clang_name and None for param_idx in get_var_name_mangled (%a) (%a)"
(Pp.to_string ~f:Clang_ast_j.string_of_named_decl_info) (Pp.of_string ~f:Clang_ast_j.string_of_named_decl_info)
name_info name_info
(Pp.to_string ~f:Clang_ast_j.string_of_var_decl_info) (Pp.of_string ~f:Clang_ast_j.string_of_var_decl_info)
var_decl_info var_decl_info
| _ -> | _ ->
clang_name clang_name

@ -71,7 +71,7 @@ let mk name class_param params ret_type ?(has_added_return_param = false) attrib
let pp fmt ms = let pp fmt ms =
let pp_param fmt {name; typ} = F.fprintf fmt "%a, %a" Mangled.pp name (Typ.pp Pp.text) typ in let pp_param fmt {name; typ} = F.fprintf fmt "%a, %a" Mangled.pp name (Typ.pp Pp.text) typ in
Format.fprintf fmt "Method %a [%a]->%a %a" Format.fprintf fmt "Method %a [%a]->%a %a"
(Pp.to_string ~f:Typ.Procname.to_string) (Pp.of_string ~f:Typ.Procname.to_string)
ms.name (Pp.comma_seq pp_param) ms.params (Typ.pp Pp.text) (fst ms.ret_type) ms.name (Pp.comma_seq pp_param) ms.params (Typ.pp Pp.text) (fst ms.ret_type)
(Pp.to_string ~f:Clang_ast_j.string_of_source_range) (Pp.of_string ~f:Clang_ast_j.string_of_source_range)
ms.loc ms.loc

@ -143,7 +143,7 @@ module Variables = struct
let rec visit_stmt stmt ((scope, map) as scope_map) = let rec visit_stmt stmt ((scope, map) as scope_map) =
L.debug Capture Verbose "%a{%a}@;" L.debug Capture Verbose "%a{%a}@;"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
stmt (Pp.seq ~sep:"," pp_var_decl) scope.current ; stmt (Pp.seq ~sep:"," pp_var_decl) scope.current ;
match (stmt : Clang_ast_t.stmt) with match (stmt : Clang_ast_t.stmt) with
| ReturnStmt (stmt_info, _) | ReturnStmt (stmt_info, _)
@ -253,10 +253,10 @@ module CXXTemporaries = struct
and visit_stmt context stmt temporaries = and visit_stmt context stmt temporaries =
L.debug Capture Verbose "<@[<hv2>%a|@," L.debug Capture Verbose "<@[<hv2>%a|@,"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
stmt ; stmt ;
let r = visit_stmt_aux context stmt temporaries in let r = visit_stmt_aux context stmt temporaries in
L.debug Capture Verbose "@]@;/%a>" (Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) stmt ; L.debug Capture Verbose "@]@;/%a>" (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string) stmt ;
r r

@ -167,7 +167,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
let stmt_info, _ = Clang_ast_proj.get_stmt_tuple stmt in let stmt_info, _ = Clang_ast_proj.get_stmt_tuple stmt in
CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range
"Clang_ast_proj.get_expr_tuple stmt returns None, stmt is %a" "Clang_ast_proj.get_expr_tuple stmt returns None, stmt is %a"
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) (Pp.of_string ~f:Clang_ast_j.string_of_stmt)
stmt stmt
in in
let res_trans = f trans_state stmt in let res_trans = f trans_state stmt in
@ -537,7 +537,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
(* FIXME(t21762295): we do not expect this to happen but it does *) (* FIXME(t21762295): we do not expect this to happen but it does *)
CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range
"di_parent_pointer should be always set for fields/ivars, but got %a" "di_parent_pointer should be always set for fields/ivars, but got %a"
(Pp.option (Pp.to_string ~f:Clang_ast_j.string_of_decl)) (Pp.option (Pp.of_string ~f:Clang_ast_j.string_of_decl))
decl decl
in in
let field_name = CGeneral_utils.mk_class_field_name class_tname field_string in let field_name = CGeneral_utils.mk_class_field_name class_tname field_string in
@ -812,7 +812,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| _ -> | _ ->
CFrontend_errors.unimplemented __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.unimplemented __POS__ stmt_info.Clang_ast_t.si_source_range
"Decl ref expression %a with pointer %d still needs to be translated" "Decl ref expression %a with pointer %d still needs to be translated"
(Pp.to_string ~f:Clang_ast_j.string_of_decl_kind) (Pp.of_string ~f:Clang_ast_j.string_of_decl_kind)
decl_kind decl_ref.Clang_ast_t.dr_decl_pointer decl_kind decl_ref.Clang_ast_t.dr_decl_pointer
@ -912,7 +912,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
and binaryOperator_trans trans_state binary_operator_info stmt_info expr_info stmt_list = and binaryOperator_trans trans_state binary_operator_info stmt_info expr_info stmt_list =
L.(debug Capture Verbose) L.(debug Capture Verbose)
" BinaryOperator '%a' " " BinaryOperator '%a' "
(Pp.to_string ~f:Clang_ast_j.string_of_binary_operator_kind) (Pp.of_string ~f:Clang_ast_j.string_of_binary_operator_kind)
binary_operator_info.Clang_ast_t.boi_kind ; binary_operator_info.Clang_ast_t.boi_kind ;
L.(debug Capture Verbose) L.(debug Capture Verbose)
" priority node free = '%s'@\n@." " priority node free = '%s'@\n@."
@ -2196,7 +2196,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
(List.length field_exps) (List.length field_exps)
(Pp.seq ~sep:"," (Pp.pair ~fst:Exp.pp ~snd:(Typ.pp Pp.text))) (Pp.seq ~sep:"," (Pp.pair ~fst:Exp.pp ~snd:(Typ.pp Pp.text)))
field_exps (List.length stmts) field_exps (List.length stmts)
(Pp.seq ~sep:"," (Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string)) (Pp.seq ~sep:"," (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string))
stmts ; stmts ;
let control, _ = instructions trans_state stmts in let control, _ = instructions trans_state stmts in
[mk_trans_result (var_exp, var_typ) control] ) [mk_trans_result (var_exp, var_typ) control] )
@ -3226,9 +3226,9 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| _ -> | _ ->
CFrontend_errors.unimplemented __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.unimplemented __POS__ stmt_info.Clang_ast_t.si_source_range
"attributedStmt with:@\nstmts=[%a]@\nattrs=[%a]@\n" "attributedStmt with:@\nstmts=[%a]@\nattrs=[%a]@\n"
(Pp.semicolon_seq (Pp.to_string ~f:Clang_ast_j.string_of_stmt)) (Pp.semicolon_seq (Pp.of_string ~f:Clang_ast_j.string_of_stmt))
stmts stmts
(Pp.semicolon_seq (Pp.to_string ~f:Clang_ast_j.string_of_attribute)) (Pp.semicolon_seq (Pp.of_string ~f:Clang_ast_j.string_of_attribute))
attrs attrs
@ -3244,7 +3244,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| None (* t21762295 *) -> | None (* t21762295 *) ->
CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range
"Break stmt without continuation: %a" "Break stmt without continuation: %a"
(Pp.to_string ~f:Clang_ast_j.string_of_stmt_info) (Pp.of_string ~f:Clang_ast_j.string_of_stmt_info)
stmt_info stmt_info
@ -3261,7 +3261,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| None (* t21762295 *) -> | None (* t21762295 *) ->
CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range CFrontend_errors.incorrect_assumption __POS__ stmt_info.Clang_ast_t.si_source_range
"Continue stmt without continuation: %a" "Continue stmt without continuation: %a"
(Pp.to_string ~f:Clang_ast_j.string_of_stmt_info) (Pp.of_string ~f:Clang_ast_j.string_of_stmt_info)
stmt_info stmt_info
@ -3314,7 +3314,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in in
L.(debug Capture Verbose) L.(debug Capture Verbose)
"Translating statement '%a' (pointer= '%a')@\n@[<hv2>" "Translating statement '%a' (pointer= '%a')@\n@[<hv2>"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
instr pp_pointer instr ; instr pp_pointer instr ;
let trans_result = let trans_result =
try instruction_scope trans_state instr try instruction_scope trans_state instr
@ -3353,7 +3353,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
in in
(if should_display_error then L.internal_error else L.debug Capture Quiet) (if should_display_error then L.internal_error else L.debug Capture Quiet)
"%a: ERROR translating statement '%a'@\n" Location.pp_range (loc_start, loc_end) "%a: ERROR translating statement '%a'@\n" Location.pp_range (loc_start, loc_end)
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
instr ) ) instr ) )
in in
L.(debug Capture Verbose) "@]" ; L.(debug Capture Verbose) "@]" ;
@ -3631,16 +3631,16 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
CFrontend_errors.unimplemented __POS__ si_source_range CFrontend_errors.unimplemented __POS__ si_source_range
~ast_node:(Clang_ast_proj.get_stmt_kind_string instr) ~ast_node:(Clang_ast_proj.get_stmt_kind_string instr)
"Translation of templated code is unsupported: %a" "Translation of templated code is unsupported: %a"
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) (Pp.of_string ~f:Clang_ast_j.string_of_stmt)
instr instr
| ForStmt ({Clang_ast_t.si_source_range}, _) | ForStmt ({Clang_ast_t.si_source_range}, _)
| WhileStmt ({Clang_ast_t.si_source_range}, _) | WhileStmt ({Clang_ast_t.si_source_range}, _)
| DoStmt ({Clang_ast_t.si_source_range}, _) | DoStmt ({Clang_ast_t.si_source_range}, _)
| ObjCForCollectionStmt ({Clang_ast_t.si_source_range}, _) -> | ObjCForCollectionStmt ({Clang_ast_t.si_source_range}, _) ->
CFrontend_errors.incorrect_assumption __POS__ si_source_range "Unexpected shape for %a: %a" CFrontend_errors.incorrect_assumption __POS__ si_source_range "Unexpected shape for %a: %a"
(Pp.to_string ~f:Clang_ast_proj.get_stmt_kind_string) (Pp.of_string ~f:Clang_ast_proj.get_stmt_kind_string)
instr instr
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) (Pp.of_string ~f:Clang_ast_j.string_of_stmt)
instr instr
| MSAsmStmt _ | MSAsmStmt _
| CapturedStmt _ | CapturedStmt _

@ -19,7 +19,7 @@ let extract_item_from_singleton l pp source_range warning_string =
item item
| _ -> | _ ->
L.die InternalError "At %a: List has %d elements, 1 expected:@\n[@[<h>%a@]]@\n%s" L.die InternalError "At %a: List has %d elements, 1 expected:@\n[@[<h>%a@]]@\n%s"
(Pp.to_string ~f:Clang_ast_j.string_of_source_range) (Pp.of_string ~f:Clang_ast_j.string_of_source_range)
source_range (List.length l) (Pp.semicolon_seq pp) l warning_string source_range (List.length l) (Pp.semicolon_seq pp) l warning_string
@ -561,7 +561,7 @@ let is_null_stmt s = match s with Clang_ast_t.NullStmt _ -> true | _ -> false
let extract_stmt_from_singleton stmt_list source_range warning_string = let extract_stmt_from_singleton stmt_list source_range warning_string =
extract_item_from_singleton stmt_list extract_item_from_singleton stmt_list
(Pp.to_string ~f:Clang_ast_j.string_of_stmt) (Pp.of_string ~f:Clang_ast_j.string_of_stmt)
source_range warning_string source_range warning_string

@ -50,7 +50,7 @@ let sil_var_of_decl_ref context source_range decl_ref procname =
(* FIXME(t21762295) *) (* FIXME(t21762295) *)
CFrontend_errors.incorrect_assumption __POS__ source_range CFrontend_errors.incorrect_assumption __POS__ source_range
"pointer '%d' for var decl not found. The var decl was: %a" pointer "pointer '%d' for var decl not found. The var decl was: %a" pointer
(Pp.to_string ~f:Clang_ast_j.string_of_decl_ref) (Pp.of_string ~f:Clang_ast_j.string_of_decl_ref)
decl_ref ) decl_ref )

@ -132,7 +132,7 @@ let option pp fmt = function
F.fprintf fmt "[Some %a]" pp x F.fprintf fmt "[Some %a]" pp x
let to_string ~f fmt x = F.pp_print_string fmt (f x) let of_string ~f fmt x = F.pp_print_string fmt (f x)
let string_of_pp pp = Format.asprintf "%a" pp let string_of_pp pp = Format.asprintf "%a" pp

@ -85,11 +85,11 @@ val comma_seq : ?print_env:env -> (F.formatter -> 'a -> unit) -> F.formatter ->
val semicolon_seq : ?print_env:env -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a list -> unit val semicolon_seq : ?print_env:env -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a list -> unit
(** Pretty print a ;-separated sequence *) (** Pretty print a ;-separated sequence *)
val to_string : f:('a -> string) -> F.formatter -> 'a -> unit val of_string : f:('a -> string) -> F.formatter -> 'a -> unit
(** turn a "to_string" function into a "pp_foo" *) (** If all you have is to_string, but you need pp_foo. *)
val string_of_pp : (F.formatter -> 'a -> unit) -> 'a -> string val string_of_pp : (F.formatter -> 'a -> unit) -> 'a -> string
(** turn "pp_foo" to "to_string" function *) (** If all you have is pp_foo, but you need to_string. *)
val current_time : F.formatter -> unit -> unit val current_time : F.formatter -> unit -> unit
(** Print the current time and date in a format similar to the "date" command *) (** Print the current time and date in a format similar to the "date" command *)

Loading…
Cancel
Save