Hide the intermediate functions from PP_generic's signature

This commit is contained in:
Suzanne Dupéron 2020-05-22 18:19:26 +01:00
parent 92069077df
commit 008f228ed7

View File

@ -3,7 +3,8 @@ open Fold
open Format open Format
open PP_helpers open PP_helpers
let needs_parens = { module M = struct
let needs_parens = {
generic = (fun state info -> generic = (fun state info ->
match info.node_instance.instance_kind with match info.node_instance.instance_kind with
| RecordInstance _ -> false | RecordInstance _ -> false
@ -36,7 +37,7 @@ let needs_parens = {
typeVariableMap = (fun _ _ _ _ -> false) ; typeVariableMap = (fun _ _ _ _ -> false) ;
} }
let op ppf = { let op ppf = {
generic = (fun () info -> generic = (fun () info ->
match info.node_instance.instance_kind with match info.node_instance.instance_kind with
| RecordInstance { fields } -> | RecordInstance { fields } ->
@ -107,11 +108,12 @@ let op ppf = {
fprintf ppf "typeVariableMap [@,@[<hv 2> %a @]@,]" (list_sep aux (fun ppf () -> fprintf ppf " ;@ ")) lst); fprintf ppf "typeVariableMap [@,@[<hv 2> %a @]@,]" (list_sep aux (fun ppf () -> fprintf ppf " ;@ ")) lst);
} }
let print : (unit fold_config -> unit -> 'a -> unit) -> formatter -> 'a -> unit = fun fold ppf v -> let print : (unit fold_config -> unit -> 'a -> unit) -> formatter -> 'a -> unit = fun fold ppf v ->
fold (op ppf) () v fold (op ppf) () v
end
include Fold.Folds(struct include Fold.Folds(struct
type state = unit ;; type state = unit ;;
type 'a t = formatter -> 'a -> unit ;; type 'a t = formatter -> 'a -> unit ;;
let f = print ;; let f = M.print ;;
end) end)