Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / unique-set.sig
1 (* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9 signature UNIQUE_SET_STRUCTS =
10 sig
11 structure Element:
12 sig
13 include T
14 val hash: t -> Word.t
15 end
16
17 (* How many binary operations to cache. *)
18 val cacheSize: int
19
20 (* 2^bits buckets in the hash table *)
21 val bits: int
22 end
23
24 signature UNIQUE_SET =
25 sig
26 include UNIQUE_SET_STRUCTS
27
28 type t
29
30 val + : t * t -> t
31 val - : t * t -> t
32 val empty: t
33 val equals: t * t -> bool
34 val foreach: t * (Element.t -> unit) -> unit
35 val fromList: Element.t list -> t
36 val intersect: t * t -> t
37 val isEmpty: t -> bool
38 val layout: t -> Layout.t
39 val plist: t -> PropertyList.t
40 val reset: unit -> unit
41 val singleton: Element.t -> t
42 val stats: unit -> {hits: int, misses: int}
43 val toList: t -> Element.t list
44 end