simplify Signatures by requiring debug [pprint] everywhere
This commit is contained in:
parent
ea30d554e8
commit
54021e46bd
|
@ -22,8 +22,8 @@ module O = struct
|
|||
let inject n =
|
||||
2 * n
|
||||
|
||||
type 'a structure =
|
||||
'a S.structure
|
||||
type 'a structure = 'a S.structure
|
||||
let pprint = S.pprint
|
||||
|
||||
type ty =
|
||||
F.nominal_type
|
||||
|
|
|
@ -126,6 +126,14 @@ type 'a data = {
|
|||
mutable mark: mark;
|
||||
}
|
||||
|
||||
(* A printer (for debugging purposes). *)
|
||||
|
||||
let pprint elem data =
|
||||
let open PPrint in
|
||||
utf8format "@%d[%d]" data.id data.rank ^^
|
||||
S.pprint elem data.structure
|
||||
(* [status] and [mark] are currently not printed. *)
|
||||
|
||||
(* This exception is raised when a rigid variable escapes its scope, that is,
|
||||
when it is unified with (or becomes a child of) a variable of lesser rank.
|
||||
At present, this exception does not carry any data; we do not yet know how
|
||||
|
@ -154,6 +162,8 @@ module Data = struct
|
|||
type 'a structure =
|
||||
'a data
|
||||
|
||||
let pprint = pprint
|
||||
|
||||
let id data =
|
||||
data.id
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ module type SSTRUCTURE = sig
|
|||
which indicates the presence of an equality constraint. *)
|
||||
type 'a structure
|
||||
|
||||
(**[pprint] is a structure printer, parameterized over a child printer.
|
||||
It is used for debugging purposes only. *)
|
||||
val pprint: ('a -> PPrint.document) -> 'a structure -> PPrint.document
|
||||
|
||||
end
|
||||
|
||||
(* -------------------------------------------------------------------------- *)
|
||||
|
@ -216,19 +220,6 @@ module type STRUCTURE_LEAF = sig
|
|||
|
||||
end
|
||||
|
||||
(* [HSTRUCTURE] describes an input of [Solver.Make]. *)
|
||||
|
||||
module type HSTRUCTURE = sig
|
||||
|
||||
(** @inline *)
|
||||
include GSTRUCTURE
|
||||
|
||||
(**[pprint] is a structure printer, parameterized over a child printer.
|
||||
It is used for debugging purposes only. *)
|
||||
val pprint: ('a -> PPrint.document) -> 'a structure -> PPrint.document
|
||||
|
||||
end
|
||||
|
||||
(* -------------------------------------------------------------------------- *)
|
||||
|
||||
(* [MUNIFIER] describes a fragment of the functionality offered by the
|
||||
|
|
|
@ -13,7 +13,7 @@ open Signatures
|
|||
|
||||
module Make
|
||||
(X : TEVAR)
|
||||
(S : HSTRUCTURE)
|
||||
(S : GSTRUCTURE)
|
||||
(O : OUTPUT with type 'a structure = 'a S.structure)
|
||||
= struct
|
||||
|
||||
|
@ -362,6 +362,7 @@ end (* UVar *)
|
|||
module D =
|
||||
Decoder.Make (G.Data) (U) (struct
|
||||
include O
|
||||
let pprint = G.Data.pprint
|
||||
let structure (s : O.ty U.structure) : O.ty =
|
||||
O.structure (OS.project_nonleaf (G.Data.project s))
|
||||
end)
|
||||
|
|
|
@ -31,7 +31,7 @@ open Signatures
|
|||
elaboration in order to construct an explicitly-typed program. *)
|
||||
module Make
|
||||
(X : sig (** @inline *) include TEVAR end)
|
||||
(S : sig (** @inline *) include HSTRUCTURE end)
|
||||
(S : sig (** @inline *) include GSTRUCTURE end)
|
||||
(O : sig (** @inline *) include OUTPUT
|
||||
with type 'a structure = 'a S.structure end)
|
||||
: sig
|
||||
|
|
|
@ -61,4 +61,7 @@ module Option (S : GSTRUCTURE) = struct
|
|||
let project_nonleaf =
|
||||
Option.get
|
||||
|
||||
let pprint elem os =
|
||||
PPrint.OCaml.option (S.pprint elem) os
|
||||
|
||||
end (* Option *)
|
||||
|
|
Loading…
Reference in New Issue