[sledge] Reorder Trm definitions

Summary: No functional change, only to enable upcoming refactors.

Reviewed By: ngorogiannis

Differential Revision: D26250539

fbshipit-source-id: c67ed87ed
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 0bcdc59086
commit daaff7ad01

@ -94,27 +94,6 @@ end = struct
| Apply of Funsym.t * t array
[@@deriving compare, equal, sexp]
module Var1 = struct
module T = struct
type nonrec t = t [@@deriving compare, equal, sexp]
let invariant x =
let@ () = Invariant.invariant [%here] x [%sexp_of: t] in
match x with
| Var _ -> ()
| _ -> fail "non-var: %a" Sexp.pp_hum (sexp_of_t x) ()
let make ~id ~name = Var {id; name} |> check invariant
let id = function Var v -> v.id | x -> violates invariant x
let name = function Var v -> v.name | x -> violates invariant x
end
include Var0.Make (T)
let of_ v = v |> check T.invariant
let of_trm = function Var _ as v -> Some v | _ -> None
end
(* nul-terminated string value represented by a concatenation *)
let string_of_concat xs =
let exception Not_a_string in
@ -174,6 +153,27 @@ end = struct
let pp = ppx (fun _ -> None)
module Var1 = struct
module T = struct
type nonrec t = t [@@deriving compare, equal, sexp]
let invariant x =
let@ () = Invariant.invariant [%here] x [%sexp_of: t] in
match x with
| Var _ -> ()
| _ -> fail "non-var: %a" Sexp.pp_hum (sexp_of_t x) ()
let make ~id ~name = Var {id; name} |> check invariant
let id = function Var v -> v.id | x -> violates invariant x
let name = function Var v -> v.name | x -> violates invariant x
end
include Var0.Make (T)
let of_ v = v |> check T.invariant
let of_trm = function Var _ as v -> Some v | _ -> None
end
let invariant e =
let@ () = Invariant.invariant [%here] e [%sexp_of: t] in
match e with

@ -25,6 +25,8 @@ type t = private
| Apply of Funsym.t * t array
[@@deriving compare, equal, sexp]
module Arith : Arithmetic.S with type trm := t with type t = arith
module Var : sig
type trm := t
@ -34,8 +36,6 @@ module Var : sig
val of_trm : trm -> t option
end
module Arith : Arithmetic.S with type trm := t with type t = arith
module Set : sig
include Set.S with type elt := t

Loading…
Cancel
Save