From cacbd099102c2c376f13a8b51f7cdcd501eb2e8a Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 7 May 2020 08:48:56 -0700 Subject: [PATCH] [istd] delete unused [is_singleton] Summary: It started with wondering which function the "O(1)" comment was about but I ended up deleting `is_singleton` because it's unused and it can be easily re-implemented. Reviewed By: ngorogiannis Differential Revision: D21425225 fbshipit-source-id: 5ee3e189c --- infer/src/istd/IContainer.ml | 3 --- infer/src/istd/IContainer.mli | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/infer/src/istd/IContainer.ml b/infer/src/istd/IContainer.ml index 9d13b874d..63e0fb344 100644 --- a/infer/src/istd/IContainer.ml +++ b/infer/src/istd/IContainer.ml @@ -4,7 +4,6 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. *) -(* Extension of Base.Container, i.e. generic definitions of container operations in terms of fold. *) open! IStd module F = Format @@ -17,8 +16,6 @@ let singleton_or_more ~fold t = match acc with Empty -> Singleton item | _ -> return More ) ) -let is_singleton ~fold t = match singleton_or_more ~fold t with Singleton _ -> true | _ -> false - let mem_nth ~fold t index = With_return.with_return (fun {return} -> let (_ : int) = diff --git a/infer/src/istd/IContainer.mli b/infer/src/istd/IContainer.mli index 8ef107eba..325ca975f 100644 --- a/infer/src/istd/IContainer.mli +++ b/infer/src/istd/IContainer.mli @@ -8,16 +8,14 @@ open! IStd module F = Format +(** Extension of {!Base.Container}, i.e. generic definitions of container operations in terms of a + [fold] function. *) + type 'a singleton_or_more = Empty | Singleton of 'a | More val singleton_or_more : fold:('t, 'a, 'a singleton_or_more) Container.fold -> 't -> 'a singleton_or_more -(* O(1) *) - -val is_singleton : fold:('t, 'a, 'a singleton_or_more) Container.fold -> 't -> bool - [@@warning "-32"] - val mem_nth : fold:('t, _, int) Container.fold -> 't -> int -> bool val forto : (int, int, 'accum) Container.fold