From 33d59b864251111af37ec3684aae817175b987ad Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Thu, 9 Jul 2020 07:43:15 -0700 Subject: [PATCH] [sledge] Refactor: Add Option.Import including Monad_infix and Monad_syntax Summary: The convention is for modules that are intended to be `open`ed, that define syntax and infix operations, are named `Import`. This diff combines the `Option.Monad_infix` and `Option.Monad_syntax` modules into `Option.Import` to follow this convention. Reviewed By: ngorogiannis Differential Revision: D22170507 fbshipit-source-id: 44378fd56 --- sledge/nonstdlib/NS.ml | 3 +-- sledge/nonstdlib/NS.mli | 3 +-- sledge/nonstdlib/option.ml | 5 +++++ sledge/nonstdlib/option.mli | 5 ++++- sledge/src/exec.ml | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sledge/nonstdlib/NS.ml b/sledge/nonstdlib/NS.ml index 405cf78d0..6af127af3 100644 --- a/sledge/nonstdlib/NS.ml +++ b/sledge/nonstdlib/NS.ml @@ -76,8 +76,7 @@ end (** Containers *) module Option = Option -include Option.Monad_infix -include Option.Monad_syntax +include Option.Import module List = List module Array = struct diff --git a/sledge/nonstdlib/NS.mli b/sledge/nonstdlib/NS.mli index 5ad4b6f01..28c9cbcfa 100644 --- a/sledge/nonstdlib/NS.mli +++ b/sledge/nonstdlib/NS.mli @@ -73,8 +73,7 @@ module Invariant : module type of Core.Invariant (** Containers *) module Option = Option -include module type of Option.Monad_infix -include module type of Option.Monad_syntax +include module type of Option.Import module List = List module Array : sig diff --git a/sledge/nonstdlib/option.ml b/sledge/nonstdlib/option.ml index 6f94a4844..84e7e4ba4 100644 --- a/sledge/nonstdlib/option.ml +++ b/sledge/nonstdlib/option.ml @@ -21,3 +21,8 @@ module Monad_syntax = struct let ( let* ) x f = bind ~f x let ( and* ) x y = both x y end + +module Import = struct + include Monad_infix + include Monad_syntax +end diff --git a/sledge/nonstdlib/option.mli b/sledge/nonstdlib/option.mli index e7e54beea..9c8b49fc0 100644 --- a/sledge/nonstdlib/option.mli +++ b/sledge/nonstdlib/option.mli @@ -16,4 +16,7 @@ val or_else : f:(unit -> 'a option) -> 'a option -> 'a option val cons : 'a t -> 'a list -> 'a list -module Monad_syntax : Monad_syntax with type 'a t := 'a option +module Import : sig + include Monad_syntax with type 'a t := 'a option + include module type of Monad_infix +end diff --git a/sledge/src/exec.ml b/sledge/src/exec.ml index 33a1683ec..70b44d323 100644 --- a/sledge/src/exec.ml +++ b/sledge/src/exec.ml @@ -637,7 +637,7 @@ let strlen_spec reg ptr = * Symbolic Execution *) -open Option.Monad_syntax +open Option.Import let check_preserve_us (q0 : Sh.t) (q1 : Sh.t) = let gain_us = Var.Set.diff q1.us q0.us in