Source file PrettyPrint.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
module Style =
  struct
    module Infix =
      struct
        type nonrec t =
          { var_prefix : string
          ; true_string : string
          ; false_string : string
          ; _not_ : string
          ; _and_ : string
          ; _or_ : string
          }

        let default =
          { var_prefix = "x"
          ; true_string = "true"
          ; false_string = "false"
          ; _not_ = "~"
          ; _and_ = " & "
          ; _or_ = " | "
          }
      end

    module Prefix =
      struct
        type nonrec t =
          { var_prefix : string
          ; true_string : string
          ; false_string : string
          ; not_ : string
          ; and_ : string
          ; or_ : string
          }

        let default =
          { var_prefix = "x"
          ; true_string = "true"
          ; false_string = "false"
          ; not_ = "not"
          ; and_ = "and"
          ; or_ = "or"
          }
      end
  end

module type Inspectable =
  sig
    type t

    val to_pretty_string : ?style:Style.Infix.t -> t -> string
  end

module type Sexpable =
  sig
    type t

    val to_pretty_sexp : ?style:Style.Prefix.t -> t -> Base.Sexp.t
    val of_pretty_sexp : ?style:Style.Prefix.t -> Base.Sexp.t -> t
  end

module type I =
  sig
    type t

    include Inspectable with type t := t

    include Sexpable with type t := t
  end