package base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file pretty_printer.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
open! Import

let r = ref [ "Base.Sexp.pp_hum" ]
let all () = !r
let register p = r := p :: !r

module type S = sig
  type t

  val pp : Formatter.t -> t -> unit
end

module Register_pp (M : sig
    include S

    val module_name : string
  end) =
struct
  include M

  let () = register (M.module_name ^ ".pp")
end

module Register (M : sig
    type t

    val module_name : string
    val to_string : t -> string
  end) =
  Register_pp (struct
    include M

    let pp formatter t = Caml.Format.pp_print_string formatter (M.to_string t)
  end)
OCaml

Innovation. Community. Security.