[MLton-commit] r6162

Vesa Karvonen vesak at mlton.org
Tue Nov 13 04:00:05 PST 2007


Started work on a library of data structures.  The purpose of this first
version is mainly to collect work done in conjunction with other libraries
to a single place.

----------------------------------------------------------------------

A   mltonlib/trunk/org/mlton/vesak/ds/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/LICENSE
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/hash-map.sml
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/linked-queue.sml
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/smlnj/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/smlnj/unsealed.cm
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/node.sml
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/unlinkable-list.sml
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.cm
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.mlb
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/export.sml
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/hash-map.sig
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/linked-queue.sig
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/node.sig
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/queue.sig
A   mltonlib/trunk/org/mlton/vesak/ds/unstable/public/unlinkable-list.sig

----------------------------------------------------------------------


Property changes on: mltonlib/trunk/org/mlton/vesak/ds/unstable
___________________________________________________________________
Name: svn:ignore
   + generated


Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/LICENSE (from rev 6161, mltonlib/trunk/org/mlton/vesak/LICENSE)
===================================================================
--- mltonlib/trunk/org/mlton/vesak/LICENSE	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/LICENSE	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,21 @@
+COPYRIGHT NOTICE, LICENSE AND DISCLAIMER.
+
+Copyright (C) 2006-2007 SSH Communications Security, Helsinki, Finland
+Copyright (C) 2007 Vesa Karvonen
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both the copyright notice and this permission notice and warranty
+disclaimer appear in supporting documentation, and that the name of
+the above copyright holders, or their entities, not be used in
+advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+The above copyright holders disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and
+fitness. In no event shall the above copyright holders be liable for
+any special, indirect or consequential damages or any damages
+whatsoever resulting from loss of use, data or profits, whether in an
+action of contract, negligence or other tortious action, arising out
+of or in connection with the use or performance of this software.

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/hash-map.sml (from rev 6161, mltonlib/trunk/com/ssh/generic/unstable/detail/util/hash-map.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/hash-map.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/hash-map.sml	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,89 @@
+(* 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.
+ *)
+
+structure HashMap :> HASH_MAP = struct
+   (* <-- SML/NJ workaround *)
+   open TopLevel
+   (* SML/NJ workaround --> *)
+
+   datatype ('a, 'b) t =
+      IN of {table : {hash : Word.t,
+                      key : 'a,
+                      value : 'b Ref.t} Node.p Vector.t Ref.t,
+             size : Int.t Ref.t,
+             eq : 'a BinPr.t,
+             hash : 'a -> Word.t}
+
+   fun table (IN r) = !(#table r)
+   fun size (IN r) = !(#size r)
+   fun eq (IN r) = #eq r
+   fun hash (IN r) = #hash r
+
+   val caps = Vector.fromList
+                 [3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191,
+                  16381, 32749, 65521, 131071, 262139, 524287, 1048573,
+                  2097143, 4194301, 8388593, 16777213, 33554393, 67108859,
+                  134217689, 268435399, 536870909, 1073741789]
+   val minCap = Vector.sub (caps, 0)
+   val maxCap = Vector.sub (caps, Vector.length caps - 1)
+
+   fun hashToIdx t hash =
+       Word.toIntX (hash mod Word.fromInt (Vector.length (table t)))
+
+   fun newTable cap = Vector.tabulate (cap, Node.ptr o ignore)
+
+   fun locate t key' = let
+      val hash' = hash t key'
+      val idx = hashToIdx t hash'
+   in
+      (hash', Node.find (fn {hash, key, ...} =>
+                            hash = hash' andalso eq t (key, key'))
+                        (Vector.sub (table t, idx)))
+   end
+
+   fun maybeGrow (t as IN {size, table, ...}) = let
+      val cap = Vector.length (!table)
+   in
+      if cap <= !size andalso cap < maxCap
+      then let
+            val newCap =
+                recur 0 (fn lp =>
+                         fn i => if Vector.sub (caps, i) = cap
+                                 then Vector.sub (caps, i+1)
+                                 else lp (i+1))
+            val oldTable = !table
+         in
+            table := newTable newCap
+          ; Vector.app (ignore o
+                        Node.appClear
+                           (fn c =>
+                               Node.push
+                                  (Vector.sub (!table, hashToIdx t (#hash c)))
+                                  c))
+                       oldTable
+         end
+      else ()
+   end
+
+   fun new {eq, hash} =
+       IN {table = ref (newTable minCap),
+           size  = ref 0,
+           eq    = eq,
+           hash  = hash}
+
+   fun find t key' =
+       case locate t key'
+        of (_, INR p) => SOME (! (#value (Node.hd p)))
+         | (_, INL _) => NONE
+
+   fun insert (t as IN {size, ...}) (key, value) =
+       case locate t key
+        of (_,    INR p) => #value (Node.hd p) := value
+         | (hash, INL p) =>
+           (Node.push p {hash = hash, key = key, value = ref value}
+          ; size := !size+1
+          ; maybeGrow t)
+end

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/linked-queue.sml (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml)
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/linked-queue.sml	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,52 @@
+(* 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.
+ *)
+
+(*
+ * An implementation of an extended version of the {QUEUE} signature.  The
+ * extensions aren't part of the {QUEUE} signature, because they don't
+ * make sense for all possible implementations of the signature.  This
+ * implementation is based on a space safe implementation by Stephen Weeks
+ * posted on the MLton developers mailing list.
+ *)
+structure LinkedQueue :> LINKED_QUEUE = struct
+   (* <-- SML/NJ workaround *)
+   open TopLevel
+   (* SML/NJ workaround --> *)
+
+   datatype 'a t = T of {back : 'a Node.p Ref.t, front : 'a Node.p Ref.t}
+
+   fun new () =
+       case Node.ptr ()
+        of p => T {back = ref p, front = ref p}
+
+   fun isEmpty (T {front, ...}) =
+       Node.isEmpty (!front)
+
+   fun length (T {front, ...}) =
+       Node.length (!front)
+
+   fun enque (T {back, ...}) =
+    fn v => let
+          val r = !back
+          val n = Node.new v
+       in
+          r := SOME n
+        ; back := Node.next n
+       end
+
+   fun deque (T {front, ...}) =
+       case !(!front)
+        of NONE   => NONE
+         | SOME n => (front := Node.next n ; SOME (Node.value n))
+
+   fun filter c (T {back, front}) =
+       back := Node.filter c (!front)
+
+   fun filterOut c = filter (negate c)
+
+   fun appClear ef (T {back, front}) =
+       back := Node.appClear ef (!front)
+end

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/smlnj/unsealed.cm	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/ml/smlnj/unsealed.cm	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,17 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+group is
+   ../../../../../../../../com/ssh/extended-basis/unstable/basis.cm
+   ../../../public/hash-map.sig
+   ../../../public/linked-queue.sig
+   ../../../public/node.sig
+   ../../../public/queue.sig
+   ../../../public/unlinkable-list.sig
+   ../../hash-map.sml
+   ../../linked-queue.sml
+   ../../node.sml
+   ../../unlinkable-list.sml

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/node.sml (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/node.sml)
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/node.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/node.sml	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,76 @@
+(* 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.
+ *)
+
+structure Node :> NODE = struct
+   (* <-- SML/NJ workaround *)
+   open TopLevel
+   infix  4 <\
+   infixr 4 />
+   (* SML/NJ workaround --> *)
+
+   datatype 'a t = T of 'a * 'a p
+   withtype 'a p = 'a t Option.t Ref.t
+
+   fun ptr () = ref NONE
+   fun new v = T (v, ptr ())
+
+   fun next (T (_, p)) = p
+   fun value (T (v, _)) = v
+
+   fun isEmpty p = isNone (!p)
+
+   fun nonEmpty f p = case !p of NONE => raise Empty | SOME n => f n
+   fun hd p = nonEmpty value p
+   fun tl p = nonEmpty next p
+
+   fun drop p = p := !(tl p)
+
+   fun push p v = let
+      val n = new v
+   in
+      next n := !p ; p := SOME n
+   end
+
+   fun pop p =
+       case !p of
+          NONE => NONE
+        | SOME (T (v, p')) => (p := !p' ; SOME v)
+
+   fun peek p =
+       case !p of
+          NONE => NONE
+        | SOME (T (v, _)) => SOME v
+
+   fun find c p =
+       case !p of
+          NONE => INL p
+        | SOME (T (v, p')) => if c v then INR p else find c p'
+
+   fun fold f s p =
+       case !p of
+          NONE => s
+        | SOME (T (v, p)) => fold f (f (v, s)) p
+
+   fun toList p = rev (fold op :: [] p)
+
+   fun length p = fold (1 <\ op + o #2) 0 p
+
+   fun filter c p =
+       case !p of
+          NONE => p
+        | SOME (T (v, n)) => if c v then filter c n else (p := !n ; filter c p)
+
+   fun appClear ef p =
+       case !p of
+          NONE => p
+        | SOME (T (v, n)) => (ef v : unit ; p := !n ; appClear ef p)
+
+   fun insert lt p v =
+       case !p of
+          NONE => push p v
+        | SOME (T (x, p')) =>
+          if lt (x, v) then insert lt p' v else push p v
+end

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/unlinkable-list.sml (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/unlinkable-list.sml)
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/unlinkable-list.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/detail/unlinkable-list.sml	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,52 @@
+(* 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.
+ *)
+
+structure UnlinkableList :> UNLINKABLE_LIST = struct
+   (* <-- SML/NJ workaround *)
+   open TopLevel
+   (* SML/NJ workaround --> *)
+
+   type 'a p = 'a Option.t Ref.t
+   val ! = fn p => case !p of SOME it => it | _ => fail "bug"
+   val op := = fn (r, v) => r := SOME v
+
+   datatype 'a t = RING of 'a l | NODE of {link : 'a l, value : 'a}
+   withtype 'a l = {pred : 'a t p, succ : 'a t p}
+
+   val link = fn RING link => link | NODE {link, ...} => link
+   fun pred n = #pred (link n)
+   fun succ n = #succ (link n)
+
+   fun newLink () = {pred = ref NONE, succ = ref NONE}
+
+   fun new () = let
+      val l = newLink () val r = RING l
+   in
+      #pred l := r ; #succ l := r ; r
+   end
+
+   fun mkUnlink {pred = lp, succ = ls} () = let
+      val p = !lp val s = !ls val n = ! (succ p)
+   in
+      ls := n ; lp := n ; succ p := s ; pred s := p
+   end
+
+   fun push (p, s, v) = let
+      val l = newLink () val n = NODE {link = l, value = v}
+   in
+      #pred l := p ; #succ l := s ; pred s := n ; succ p := n
+    ; mkUnlink l
+   end
+   fun pushFront r v = push (r, ! (succ r), v)
+   fun pushBack r v = push (! (pred r), r, v)
+
+   fun pop which r =
+       case ! (which r) of
+          RING _ => NONE
+        | NODE {link, value} => (mkUnlink link () ; SOME value)
+   fun popFront r = pop succ r
+   fun popBack r = pop pred r
+end

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.cm
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.cm	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.cm	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+library
+   source(public/export.sml)
+is
+   detail/ml/smlnj/unsealed.cm
+   public/export.sml

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.mlb	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.mlb	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,32 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+local
+   $(MLTON_LIB)/com/ssh/extended-basis/unstable/basis.mlb
+in
+   ann
+      "forceUsed"
+      "sequenceNonUnit warn"
+      "warnUnused true"
+   in
+      local
+         public/node.sig
+         detail/node.sml
+
+         public/queue.sig
+         public/linked-queue.sig
+         detail/linked-queue.sml
+
+         public/unlinkable-list.sig
+         detail/unlinkable-list.sml
+
+         public/hash-map.sig
+         detail/hash-map.sml
+      in
+         public/export.sml
+      end
+   end
+end


Property changes on: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.mlb
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,17 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+lib {reqs = ["../../../../../com/ssh/extended-basis/unstable/basis.use"],
+     self = ["public/node.sig",
+             "detail/node.sml",
+             "public/queue.sig",
+             "public/linked-queue.sig",
+             "detail/linked-queue.sml",
+             "public/unlinkable-list.sig",
+             "detail/unlinkable-list.sml",
+             "public/hash-map.sig",
+             "detail/hash-map.sml",
+             "public/export.sml"]} ;


Property changes on: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/public/export.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/public/export.sml	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,20 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(** == Exported Signatures == *)
+
+signature HASH_MAP = HASH_MAP
+signature LINKED_QUEUE = LINKED_QUEUE
+signature NODE = NODE
+signature QUEUE = QUEUE
+signature UNLINKABLE_LIST = UNLINKABLE_LIST
+
+(** == Exported Structures == *)
+
+structure HashMap : HASH_MAP = HashMap
+structure LinkedQueue : LINKED_QUEUE = LinkedQueue
+structure Node : NODE = Node
+structure UnlinkableList : UNLINKABLE_LIST = UnlinkableList


Property changes on: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/export.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/hash-map.sig (from rev 6161, mltonlib/trunk/com/ssh/generic/unstable/detail/util/hash-map.sml)
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/hash-map.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/public/hash-map.sig	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,13 @@
+(* 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 HASH_MAP = sig
+   type ('a, 'b) t
+   val new : {eq : 'a BinPr.t, hash : 'a -> Word.t} -> ('a, 'b) t
+   val size : ('a, 'b) t -> Int.t
+   val insert : ('a, 'b) t -> ('a * 'b) Effect.t
+   val find : ('a, 'b) t -> 'a -> 'b Option.t
+end

Added: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/linked-queue.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/public/linked-queue.sig	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/public/linked-queue.sig	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature LINKED_QUEUE = sig
+   include QUEUE
+   val filter : 'a UnPr.t -> 'a t Effect.t
+   val filterOut : 'a UnPr.t -> 'a t Effect.t
+end


Property changes on: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/linked-queue.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/node.sig (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/node.sml)
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/node.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/public/node.sig	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,50 @@
+(* 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 an imperative singly linked list node.  This is useful
+ * and possibly more convenient and efficient than a functional list when
+ * implementing imperative data structures (e.g. imperative hast tables).
+ *
+ * Note that imperative lists may form cycles and, unless otherwise
+ * specified, procedures specified in this module are not specifically
+ * designed to work with cyclic lists.
+ *)
+signature NODE = sig
+   type 'a t
+   type 'a p = 'a t Option.t Ref.t
+
+   val new : 'a -> 'a t
+   val ptr : 'a p Thunk.t
+
+   val next : 'a t -> 'a p
+   val value : 'a t -> 'a
+
+   val isEmpty : 'a p UnPr.t
+
+   val length : 'a p -> Int.t
+
+   val hd : 'a p -> 'a
+   val tl : 'a p UnOp.t
+
+   val push : 'a p -> 'a Effect.t
+   val pop : 'a p -> 'a Option.t
+
+   val peek : 'a p -> 'a Option.t
+
+   val drop : 'a p Effect.t
+
+   val find : 'a UnPr.t -> 'a p -> ('a p, 'a p) Sum.t
+   val fold : ('a * 's -> 's) -> 's -> 'a p -> 's
+
+   val toList : 'a p -> 'a List.t
+
+   val filter : 'a UnPr.t -> 'a p UnOp.t
+
+   val appClear : 'a Effect.t -> 'a p UnOp.t
+
+   val insert : 'a BinPr.t -> 'a p -> 'a Effect.t
+end

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/queue.sig (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/queue.sig)

Copied: mltonlib/trunk/org/mlton/vesak/ds/unstable/public/unlinkable-list.sig (from rev 6161, mltonlib/trunk/com/ssh/misc-util/unstable/unlinkable-list.sml)
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/unlinkable-list.sml	2007-11-12 20:49:00 UTC (rev 6161)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/public/unlinkable-list.sig	2007-11-13 12:00:03 UTC (rev 6162)
@@ -0,0 +1,17 @@
+(* 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 UNLINKABLE_LIST = sig
+   type 'a t
+
+   val new : 'a t Thunk.t
+
+   val pushFront : 'a t -> 'a -> Unit.t Effect.t
+   val pushBack : 'a t -> 'a -> Unit.t Effect.t
+
+   val popFront : 'a t -> 'a Option.t
+   val popBack : 'a t -> 'a Option.t
+end




More information about the MLton-commit mailing list