[MLton-commit] r5068
Vesa Karvonen
vesak at mlton.org
Fri Jan 12 04:41:15 PST 2007
Initial commit of a lib of misc utils to be refactored.
----------------------------------------------------------------------
A mltonlib/trunk/com/ssh/misc-util/unstable/word-table.sig
----------------------------------------------------------------------
Added: mltonlib/trunk/com/ssh/misc-util/unstable/word-table.sig
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/word-table.sig 2007-01-12 12:40:56 UTC (rev 5067)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/word-table.sig 2007-01-12 12:41:10 UTC (rev 5068)
@@ -0,0 +1,55 @@
+(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(*
+ * Signature for a low-level imperative polymorphic mapping from words to
+ * values intended for building hash table like containers. The idea is
+ * that the client makes sure that the distribution of words used as keys
+ * is sufficiently random, while the word table takes care of stuff like
+ * resizing the table.
+ *)
+
+signature WORD_TABLE = sig
+ eqtype 'a t
+ (** The type of word tables. *)
+
+ structure Key : WORD
+ (** Substructure specifying the word type used as keys. *)
+
+ val new : 'a t Thunk.t
+ (** Allocates a new word table. *)
+
+ val == : 'a t BinPr.t
+ (** Equality predicate. *)
+
+ val size : 'a t -> Int.t
+ (** Returns the number of associations stored in the word table. *)
+
+ (**
+ * The {Action} substructure specifies type-safe combinators for
+ * expressing actions to take on access. In particular, the
+ * combinators prevent the user from inserting or removing an element
+ * multiple times during a single access.
+ *)
+ structure Action : sig
+ type ('v, 'r) t
+ type ('v, 'r, 's) m
+ type some
+ type none
+
+ val get : {some : 'v -> ('v, 'r, some) m,
+ none : ('v, 'r, none) m Thunk.t} -> ('v, 'r) t
+ val peek : {some : ('v, 'r, some) m Thunk.t,
+ none : ('v, 'r, none) m Thunk.t} -> ('v, 'r) t
+ val insert : 'v -> 'r -> ('v, 'r, none) m
+ val update : 'v -> 'r -> ('v, 'r, some) m
+ val remove : 'r -> ('v, 'r, some) m
+ val return : 'r -> ('v, 'r, 's) m
+ end
+
+ val access : 'v t -> Key.t -> ('v, 'r) Action.t -> 'r
+ (** Performs an action on an association of the word table. *)
+end
Property changes on: mltonlib/trunk/com/ssh/misc-util/unstable/word-table.sig
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the MLton-commit
mailing list