Have separate ppf and Yojson modules for PP_json
This commit is contained in:
parent
65161148d3
commit
018e269b2e
@ -76,13 +76,23 @@ module M = struct
|
||||
`Assoc ["typeVariableMap", `List lst'] );
|
||||
}
|
||||
|
||||
let print : ((no_state, json) fold_config -> no_state -> 'a -> json) -> 'a -> json = fun fold v ->
|
||||
let to_json : ((no_state, json) fold_config -> no_state -> 'a -> json) -> 'a -> json = fun fold v ->
|
||||
fold to_json NoState v
|
||||
|
||||
let print : ((no_state, json) fold_config -> no_state -> 'a -> json) -> formatter -> 'a -> unit = fun fold ppf v ->
|
||||
fprintf ppf "%a" Yojson.Basic.pp (to_json fold v)
|
||||
end
|
||||
|
||||
module Yojson = Fold.Folds(struct
|
||||
type in_state = M.no_state ;;
|
||||
type out_state = json ;;
|
||||
type 'a t = 'a -> json ;;
|
||||
let f = M.to_json ;;
|
||||
end)
|
||||
|
||||
include Fold.Folds(struct
|
||||
type in_state = M.no_state ;;
|
||||
type out_state = json ;;
|
||||
type 'a t = 'a -> json ;;
|
||||
type 'a t = formatter -> 'a -> unit ;;
|
||||
let f = M.print ;;
|
||||
end)
|
||||
|
@ -4,7 +4,7 @@ let program_ppformat ~display_format f (typed,_) =
|
||||
match display_format with
|
||||
| Human_readable | Dev -> PP.program f typed
|
||||
|
||||
let program_jsonformat (typed,_) : json = PP_json.program typed
|
||||
let program_jsonformat (typed,_) : json = PP_json.Yojson.program typed
|
||||
|
||||
let program_format : 'a format = {
|
||||
pp = program_ppformat;
|
||||
|
Loading…
Reference in New Issue
Block a user