From 84234b7d37465641d2c1719b6d56f0bacf121d5b Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Thu, 29 Oct 2020 13:27:13 -0700 Subject: [PATCH] [sledge] Add Var.of_trm Reviewed By: ngorogiannis Differential Revision: D24532352 fbshipit-source-id: 829a76ebe --- sledge/src/trm.ml | 2 ++ sledge/src/trm.mli | 1 + 2 files changed, 3 insertions(+) diff --git a/sledge/src/trm.ml b/sledge/src/trm.ml index ef9bf4204..381ccf61b 100644 --- a/sledge/src/trm.ml +++ b/sledge/src/trm.ml @@ -18,6 +18,7 @@ module rec Var : sig include Ses.Var_intf.VAR with type t = private Trm.t val of_ : Trm.t -> t + val of_trm : Trm.t -> t option end = struct module T = struct type t = Trm.t [@@deriving compare, equal, sexp] @@ -36,6 +37,7 @@ end = struct include Ses.Var0.Make (T) let of_ v = v |> check T.invariant + let of_trm = function Trm.Var _ as v -> Some v | _ -> None end and Arith0 : diff --git a/sledge/src/trm.mli b/sledge/src/trm.mli index e178734ed..f9b453b6b 100644 --- a/sledge/src/trm.mli +++ b/sledge/src/trm.mli @@ -36,6 +36,7 @@ module Var : sig include Ses.Var_intf.VAR with type t = private trm val of_ : trm -> t + val of_trm : trm -> t option end module Arith :