[MLton-commit] r4829

Vesa Karvonen vesak at mlton.org
Fri Nov 17 04:39:05 PST 2006


Commit of some basic utilities (still more to come).

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

A   mltonlib/trunk/com/ssh/basic/unstable/basic.cm
U   mltonlib/trunk/com/ssh/basic/unstable/basic.mlb
A   mltonlib/trunk/com/ssh/basic/unstable/detail/bin-op.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/bin-pr.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/buffer.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/cmp.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/effect.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/fix.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/fn.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/iso.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/order.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/pair.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/product.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/reader.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/ref.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/
A   mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/pre-emb-iso.cm
A   mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/unsealed.cm
A   mltonlib/trunk/com/ssh/basic/unstable/detail/sq.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/sum.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/thunk.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/tie.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/un-op.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/un-pr.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/univ.sml
A   mltonlib/trunk/com/ssh/basic/unstable/detail/writer.sml
A   mltonlib/trunk/com/ssh/basic/unstable/public/bin-op.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/bin-pr.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/buffer.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/cmp.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/effect.sig
U   mltonlib/trunk/com/ssh/basic/unstable/public/export.sml
A   mltonlib/trunk/com/ssh/basic/unstable/public/fix.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/fn.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/iso.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/order.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/pair.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/product-type.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/product.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/reader.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/ref.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/sq.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/sum.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/thunk.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/tie.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/un-op.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/un-pr.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/univ.sig
A   mltonlib/trunk/com/ssh/basic/unstable/public/writer.sig

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

Added: mltonlib/trunk/com/ssh/basic/unstable/basic.cm
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/basic.cm	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/basic.cm	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+library
+   source(public/export.sml)
+is
+   detail/smlnj/unsealed.cm
+   public/export.sml

Modified: mltonlib/trunk/com/ssh/basic/unstable/basic.mlb
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/basic.mlb	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/basic.mlb	2006-11-17 12:38:45 UTC (rev 4829)
@@ -13,10 +13,119 @@
       "warnUnused true"
    in
       local
-         public/exit.sig
-         detail/exit.sml
+         (* The following is basically an experiment in having explicit
+          * dependencies.  Each basis defined below is self contained.
+          * Interface and implementation dependencies aren't separated.
+          *)
+
+         basis Fn = bas public/fn.sig detail/fn.sml end
+         basis Sq = bas public/sq.sig detail/sq.sml end
+         basis UnOp = bas public/un-op.sig detail/un-op.sml end
+         basis Thunk = let
+            open Fn
+         in
+            bas public/thunk.sig detail/thunk.sml end
+         end
+         basis Univ = let
+            open Thunk
+         in
+            bas public/univ.sig detail/univ.sml end
+         end
+         basis BinOp = let
+            open Sq
+         in
+            bas public/bin-op.sig detail/bin-op.sml end
+         end
+         basis Effect = let
+            open UnOp
+         in
+            bas public/effect.sig detail/effect.sml end
+         end
+         basis Fix = let open UnOp in bas public/fix.sig detail/fix.sml end end
+         basis UnPr = let
+            open BinOp UnOp
+         in
+            bas public/un-pr.sig detail/un-pr.sml end
+         end
+         basis Order = let
+            open Thunk UnOp UnPr
+         in
+            bas public/order.sig detail/order.sml end
+         end
+         basis BinPr = let
+            open Sq UnPr
+         in
+            bas public/bin-pr.sig detail/bin-pr.sml end
+         end
+         basis Cmp = let
+            open BinPr Order Sq
+         in
+            bas public/cmp.sig detail/cmp.sml end
+         end
+         basis Ref = let
+            open BinPr Effect Sq UnOp
+         in
+            bas public/ref.sig detail/ref.sml end
+         end
+         basis Prod = let
+            open BinPr Cmp Effect Fn Order Thunk UnPr
+         in
+            bas
+               public/product-type.sig
+               public/pair.sig
+               detail/pair.sml
+               public/product.sig
+               detail/product.sml
+            end
+         end
+         basis Sum = let
+            open BinPr Cmp Effect UnOp UnPr
+         in
+            bas public/sum.sig detail/sum.sml end
+         end
+         basis Iso = let
+            open Fn Prod Sum
+         in
+            bas public/iso.sig detail/iso.sml end
+         end
+         basis Tie = let
+            open Effect Fix Fn Iso Prod Sq Thunk UnOp
+         in
+            bas public/tie.sig detail/tie.sml end
+         end
+         basis Buffer = let
+            open Effect Fn Prod Thunk UnOp
+         in
+            bas public/buffer.sig detail/buffer.sml end
+         end
+         basis Reader = let
+            open Fn Prod Thunk Univ
+         in
+            bas public/reader.sig detail/reader.sml end
+         end
+         basis Writer = let
+            open Fn Prod Effect Univ
+         in
+            bas public/writer.sig detail/writer.sml end
+         end
+         basis Exit = bas public/exit.sig detail/exit.sml end
+
+         open BinOp BinPr Buffer
+         open Cmp
+         open Effect Exit
+         open Fix Fn
+         open Iso
+         open Order
+         open Prod
+         open Reader Ref
+         open Sq Sum
+         open Thunk Tie
+         open Univ UnOp UnPr
+         open Writer
       in
          public/export.sml
+         public/top-level.sml
+         public/infixes.sml
       end
    end
 end

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/bin-op.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/bin-op.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/bin-op.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,9 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure BinOp :> BIN_OP = struct
+   type 'a t = 'a Sq.t -> 'a
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/bin-op.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/bin-pr.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/bin-pr.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/bin-pr.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,9 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure BinPr :> BIN_PR = struct
+   type 'a t = 'a Sq.t UnPr.t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/bin-pr.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/buffer.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/buffer.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/buffer.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,54 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Buffer :> BUFFER = struct
+   structure A = Array and AS = ArraySlice and V = Vector and VS = VectorSlice
+   datatype 'a t = IN of {length : int ref, data : 'a A.t ref}
+   fun new () = IN {length = ref 0, data = ref (A.fromList [])}
+   fun duplicate (IN {length, data}) =
+       IN {length = ref (!length), data = ref (A.duplicate (!data))}
+   fun length (IN {length, ...}) = !length
+   fun data (IN {data, ...}) = !data
+   fun sub (b, i) = if length b <= i then raise Subscript else A.sub (data b, i)
+   local
+      fun cap b = A.length (data b)
+      fun decideCap c r = if r <= c then c else decideCap (2*c+1) r
+   in
+      fun ensureCap (b as IN {data, ...}) reqCap filler =
+          if reqCap <= cap b then ()
+          else let val oldData = !data
+               in data := A.tabulate (decideCap (cap b) reqCap,
+                                      fn i => if A.length oldData <= i then
+                                                 filler
+                                              else
+                                                 A.sub (oldData, i))
+               end
+   end
+   local
+      fun mk sLength sSub sCopy (b as IN {length, data}, s) =
+          case sLength s of
+             0 => ()
+           | n => let
+                val newLength = !length + n
+             in ensureCap b newLength (sSub (s, 0))
+              ; sCopy {src = s, dst = !data, di = !length} : unit
+              ; length := newLength
+             end
+   in
+      fun push ? = mk (Fn.const 1) Pair.fst
+                      (fn {src, dst, di} => A.update (dst, di, src)) ?
+      fun pushArray ? = mk A.length A.sub A.copy ?
+      fun pushArraySlice ? = mk AS.length AS.sub AS.copy ?
+      fun pushVector ? = mk V.length V.sub A.copyVec ?
+      fun pushVectorSlice ? = mk VS.length VS.sub AS.copyVec ?
+   end
+   local
+      fun mk tabulate b = tabulate (length b, fn i => sub (b, i))
+   in
+      fun toArray  ? = mk A.tabulate ?
+      fun toVector ? = mk V.tabulate ?
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/buffer.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/cmp.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/cmp.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/cmp.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,17 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Cmp :> CMP = struct
+   type 'a t = 'a Sq.t -> Order.t
+
+   fun mkRelOps cmp = let
+      open Order
+   in
+      {<  = isLess    o cmp, <= = not o isGreater o cmp,
+       == = isEqual   o cmp, != = not o isEqual   o cmp,
+       >  = isGreater o cmp, >= = not o isLess    o cmp}
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/cmp.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/effect.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/effect.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/effect.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,13 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Effect :> EFFECT = struct
+   type 'a t = 'a -> unit
+   val ignore = ignore
+   val nop = ignore
+   fun obs ef x = (ef x : unit ; x)
+   fun past ef x = (ef () : unit ; x)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/effect.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/fix.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/fix.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/fix.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,10 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Fix :> FIX = struct
+   type 'a t = 'a UnOp.t -> 'a
+   exception Fix
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/fix.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/fn.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/fn.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/fn.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,24 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Fn :> FN = struct
+   type ('a, 'b) t = 'a -> 'b
+   fun map (f, g) h = g o h o f
+   fun const x _ = x
+   fun curry f x y = f (x, y)
+   fun failing e _ = raise e
+   fun flip f x y = f y x
+   fun id x = x
+   fun uncurry f (x, y) = f x y
+   val op o = op o
+   fun undefined _ = raise Fail "undefined"
+   fun op <\ (x, f) y = f (x, y)
+   fun op \> (f, y) = f y
+   fun op /> (f, y) x = f (x, y)
+   fun op </ (x, f) = f x
+   val op >| = op </
+   val op |< = op \>
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/fn.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/iso.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/iso.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/iso.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,25 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Iso : ISO = struct
+   open Iso
+
+   infix <-->
+
+   val swap = Pair.swap
+
+   fun (a2b, b2a) <--> (c2a, a2c) = (a2b o c2a, a2c o b2a)
+
+   fun map (l, r) iso = r <--> iso <--> l
+
+   local
+      fun mk map = Pair.map map o Pair.swizzle
+   in
+      fun op --> ? = mk (Fn.map, Fn.map) ?
+      fun op  +` ? = mk (Sum.map, Sum.map) ?
+      fun op  *` ? = mk (Product.map, Product.map) ?
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/iso.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/order.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/order.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/order.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,17 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Order :> ORDER = struct
+   datatype t = datatype order
+   val swap = fn LESS    => GREATER
+               | EQUAL   => EQUAL
+               | GREATER => LESS
+   fun isEqual   x = x = EQUAL
+   fun isGreater x = x = GREATER
+   fun isLess    x = x = LESS
+   val orWhenEq = fn (EQUAL, th) => th ()
+                   | (other,  _) => other
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/order.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/pair.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/pair.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/pair.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,52 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Pair : PAIR = struct
+   type ('a, 'b) pair = 'a * 'b
+   type ('a, 'b) t = ('a, 'b) pair
+
+   val isoTuple2 as (fromTuple2, toTuple2) =
+       (fn (a, b) => (a, b),
+        fn (a, b) => (a, b))
+   val isoTuple3 as (fromTuple3, toTuple3) =
+       (fn (a, b, c) => ((a, b), c),
+        fn ((a, b), c) => (a, b, c))
+   val isoTuple4 as (fromTuple4, toTuple4) =
+       (fn (a, b, c, d) => (((a, b), c), d),
+        fn (((a, b), c), d) => (a, b, c, d))
+
+   fun swap (a, b) = (b, a)
+   fun swizzle ((a, b), (c, d)) = ((a, c), (b, d))
+
+   fun fst (a, _) = a
+   fun snd (_, b) = b
+
+   fun app (ea, eb) (a, b) = (ea a : unit ; eb b : unit)
+   fun appFst eA = app (eA, Effect.ignore)
+   fun appSnd eB = app (Effect.ignore, eB)
+
+   fun map (fa, fb) (a, b) = (fa a, fb b)
+   fun mapFst fA = map (fA, Fn.id)
+   fun mapSnd fB = map (Fn.id, fB)
+
+   local
+      fun mk p (fA, fB) (a, b) = let
+         val a = fA a
+      in
+         if p a then a else fB b
+      end
+   in
+      fun all     ? = mk Bool.isFalse  ?
+      fun exists  ? = mk Bool.isTrue   ?
+      fun equal   ? = mk Bool.isFalse  ? o swizzle
+      fun collate ? = mk Order.isEqual ? o swizzle
+   end
+
+   fun foldl (fa, fb) ((a, b), s) = fb (b, fa (a, s))
+   fun foldr (fa, fb) ((a, b), s) = fa (a, fb (b, s))
+
+   fun thunk (na, nb) () = (na (), nb ())
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/pair.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/product.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/product.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/product.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,54 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Product : PRODUCT = struct
+   datatype ('a, 'b) product = & of 'a * 'b
+   type ('a, 'b) t = ('a, 'b) product
+
+   infix &
+
+   val isoTuple2 as (fromTuple2, toTuple2) =
+       (fn (a, b) => a & b,
+        fn a & b => (a, b))
+   val isoTuple3 as (fromTuple3, toTuple3) =
+       (fn (a, b, c) => a & b & c,
+        fn a & b & c => (a, b, c))
+   val isoTuple4 as (fromTuple4, toTuple4) =
+       (fn (a, b, c, d) => a & b & c & d,
+        fn a & b & c & d => (a, b, c, d))
+
+   fun swap (a & b) = b & a
+   fun swizzle ((a & b), (c & d)) = ((a, c) & (b, d))
+
+   fun fst (a & _) = a
+   fun snd (_ & b) = b
+
+   fun app (eA, eB) (a & b) = (eA a : unit ; eB b : unit)
+   fun appFst eA = app (eA, Effect.ignore)
+   fun appSnd eB = app (Effect.ignore, eB)
+
+   fun map (fA, fB) (a & b) = fA a & fB b
+   fun mapFst fA = map (fA, Fn.id)
+   fun mapSnd fB = map (Fn.id, fB)
+
+   local
+      fun mk p (fA, fB) (a & b) = let
+         val a = fA a
+      in
+         if p a then a else fB b
+      end
+   in
+      fun all     ? = mk Bool.isFalse  ?
+      fun exists  ? = mk Bool.isTrue   ?
+      fun equal   ? = mk Bool.isFalse  ? o swizzle
+      fun collate ? = mk Order.isEqual ? o swizzle
+   end
+
+   fun foldl (fA, fB) (a & b, s) = fB (b, fA (a, s))
+   fun foldr (fA, fB) (a & b, s) = fA (a, fB (b, s))
+
+   fun thunk (nA, nB) () = nA () & nB ()
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/product.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/reader.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/reader.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/reader.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,27 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Reader :> READER = struct
+   type ('a, 'b) t = 'b -> ('a * 'b) Option.t
+
+   infix >>= >>&
+
+   fun return a s = SOME (a, s)
+   fun rA >>= a2rB = Option.mapPartial (Fn.uncurry a2rB) o rA
+
+   fun map a2b rA = rA >>= return o a2b
+   fun rA >>& rB = rA >>= (fn a => rB >>= (fn b => return (Product.& (a, b))))
+
+   type univ = Univ.t
+   type 'a u = ('a, univ) t
+
+   fun polymorphically uA2uB = let
+      val (to, from) = Univ.newIso ()
+      fun map f = Option.map (Pair.map (Fn.id, f))
+   in
+      Fn.map (to, map from) o uA2uB o Fn.map (from, map to)
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/reader.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/ref.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/ref.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/ref.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,24 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Ref : REF = struct
+   type 'a t = 'a ref
+   val new = ref
+   val ! = !
+   val op := = op :=
+   fun op :=: (r1, r2) = let
+      val v1 = !r1
+      val v2 = !r2
+   in
+      r1 := v2
+    ; r2 := v1
+   end
+   fun exchange (r, v) = !r before r := v
+   fun app ef = ef o !
+   fun map f = new o f o !
+   fun modify f r = r := f (!r)
+   val equal = op =
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/ref.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/pre-emb-iso.cm
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/pre-emb-iso.cm	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/pre-emb-iso.cm	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,54 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+group is
+   ../../../../extended-basis/unstable/basis.cm
+   ../../public/bin-op.sig
+   ../../public/bin-pr.sig
+   ../../public/buffer.sig
+   ../../public/cmp.sig
+   ../../public/effect.sig
+   ../../public/exit.sig
+   ../../public/fix.sig
+   ../../public/fn.sig
+   ../../public/order.sig
+   ../../public/pair.sig
+   ../../public/product-type.sig
+   ../../public/product.sig
+   ../../public/random-gen.sig
+   ../../public/reader.sig
+   ../../public/ref.sig
+   ../../public/rng.sig
+   ../../public/sq.sig
+   ../../public/sum.sig
+   ../../public/thunk.sig
+   ../../public/tie.sig
+   ../../public/un-op.sig
+   ../../public/un-pr.sig
+   ../../public/univ.sig
+   ../../public/writer.sig
+   ../bin-op.sml
+   ../bin-pr.sml
+   ../buffer.sml
+   ../cmp.sml
+   ../effect.sml
+   ../exit.sml
+   ../fix.sml
+   ../fn.sml
+   ../mk-random-gen.fun
+   ../order.sml
+   ../pair.sml
+   ../product.sml
+   ../reader.sml
+   ../ref.sml
+   ../sq.sml
+   ../sum.sml
+   ../thunk.sml
+   ../tie.sml
+   ../un-op.sml
+   ../un-pr.sml
+   ../univ.sml
+   ../writer.sml

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/unsealed.cm	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/smlnj/unsealed.cm	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+group is
+   ../../../../extended-basis/unstable/basis.cm
+   ../../public/iso.sig
+   ../iso.sml
+   pre-emb-iso.cm

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/sq.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/sq.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/sq.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,10 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Sq :> SQ = struct
+   type 'a t = 'a * 'a
+   fun mk x = (x, x)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/sq.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/sum.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/sum.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/sum.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,43 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Sum : SUM = struct
+   datatype ('a, 'b) sum = INL of 'a | INR of 'b
+   type('a, 'b) t = ('a, 'b) sum
+
+   exception Sum
+
+   fun sum (fA, fB) = fn INL a => fA a | INR b => fB b
+
+   val swap = fn INL x => INR x | INR x => INL x
+
+   val out = fn INL x => x | INR x => x
+
+   val app = sum
+   fun map (fA, fB) = sum (INL o fA, INR o fB)
+
+   val isL = fn INL _ => true | INR _ => false
+   val outL = fn INL l => l | INR _ => raise Sum
+   val getL = fn INL x => (fn _ => x) | INR _ => (fn x => x)
+   fun mapL f = map (f, fn r => r)
+
+   fun isR ? = (isL o swap) ?
+   fun outR ? = (outL o swap) ?
+   fun getR ? = (getL o swap) ?
+   fun mapR f = swap o mapL f o swap
+
+   fun equal (eqA, eqB) =
+       fn (INL l, INL r) => eqA (l, r)
+        | (INL _, INR _) => false
+        | (INR _, INL _) => false
+        | (INR l, INR r) => eqB (l, r)
+
+   fun collate (cmpA, cmpB) =
+       fn (INL l, INL r) => cmpA (l, r)
+        | (INL _, INR _) => LESS
+        | (INR _, INL _) => GREATER
+        | (INR l, INR r) => cmpB (l, r)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/sum.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/thunk.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/thunk.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/thunk.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,10 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Thunk :> THUNK = struct
+   type 'a t = unit -> 'a
+   val mk = Fn.const
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/thunk.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/tie.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/tie.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/tie.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,23 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Tie :> TIE = struct
+   type 'a t_domain = unit
+   type 'a t_range = 'a * 'a UnOp.t
+   type 'a t = 'a t_domain -> 'a t_range
+   fun fix a f = let val (a, ta) = a () in ta (f a) end
+   val pure = Fn.id
+   fun tier th = (fn (a, ta) => (a, Fn.const a o ta)) o th
+   fun iso tb iso = Pair.map (Iso.from iso, Fn.map iso) o tb
+   fun op *` (a, b) = Pair.map (Product.&, Product.map) o
+                      Pair.swizzle o Pair.map (a, b) o Sq.mk
+   fun tuple2 (a, b) = iso (op *` (a, b)) Product.isoTuple2
+   fun option () = (NONE, Fn.id)
+   fun fromRef rf x = !rf x
+   fun function ? =
+       tier (fn () => Pair.map (fromRef, Fn.curry op :=)
+                               (Sq.mk (ref (Fn.failing Fix.Fix)))) ?
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/tie.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/un-op.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/un-op.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/un-op.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,9 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure UnOp :> UN_OP = struct
+   type 'a t = 'a -> 'a
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/un-op.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/un-pr.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/un-pr.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/un-pr.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,12 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure UnPr :> UN_PR = struct
+   type 'a t = 'a -> bool
+   fun op andAlso (p, q) ? = p ? andalso q ?
+   fun op orElse (p, q) ? = p ? orelse q ?
+   fun negate p = not o p
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/un-pr.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/univ.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/univ.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/univ.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,21 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Univ :> UNIV = struct
+   type t = exn
+
+   fun newIso () = let
+      exception U of 'a
+   in
+      (U, fn U ? => ? | _ => raise Match)
+   end
+
+   fun newEmb () = let
+      exception U of 'a
+   in
+      (U, fn U ? => SOME ? | _ => NONE)
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/univ.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/detail/writer.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/writer.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/writer.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,21 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Writer :> WRITER = struct
+   type ('a, 'b) t = 'a * 'b -> 'b
+
+   fun map b2a wA = wA o Pair.map (b2a, Fn.id)
+
+   type univ = Univ.t
+   type 'a u = ('a, univ) t
+
+   fun polymorphically uA2uB = let
+      val (to, from) = Univ.newIso ()
+      fun map f = Pair.map (Fn.id, f)
+   in
+      Fn.map (map to, from) o uA2uB o Fn.map (map from, to)
+   end
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/writer.sml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/bin-op.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/bin-op.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/bin-op.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with binary operators. *)
+signature BIN_OP = sig
+   type 'a t = 'a Sq.t -> 'a
+   (** Type of binary operators (e.g. {+, -, @, ...}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/bin-op.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/bin-pr.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/bin-pr.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/bin-pr.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with binary predicates. *)
+signature BIN_PR = sig
+   type 'a t = 'a Sq.t UnPr.t
+   (** Type of binary predicates or relations (e.g. {<, <=, >=, >, ...}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/bin-pr.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/buffer.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/buffer.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/buffer.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,28 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Imperative dynamically growing buffer. *)
+signature BUFFER = sig
+   type 'a t
+
+   val new : 'a t Thunk.t
+
+   val duplicate : 'a t UnOp.t
+
+   val length : 'a t -> Int.t
+
+   val sub : 'a t * Int.t -> 'a
+
+   val push : ('a t * 'a) Effect.t
+
+   val pushArray : ('a t * 'a Array.t) Effect.t
+   val pushArraySlice : ('a t * 'a ArraySlice.t) Effect.t
+   val pushVector : ('a t * 'a Vector.t) Effect.t
+   val pushVectorSlice : ('a t * 'a VectorSlice.t) Effect.t
+
+   val toArray : 'a t -> 'a Array.t
+   val toVector : 'a t -> 'a Vector.t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/buffer.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/cmp.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/cmp.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/cmp.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,16 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with compare functions. *)
+signature CMP = sig
+   type 'a t = 'a Sq.t -> Order.t
+   (** Type of compare functions (e.g. {Int.compare, String.compare, ...}). *)
+
+   val mkRelOps : 'a t -> {<  : 'a BinPr.t, <= : 'a BinPr.t,
+                           >  : 'a BinPr.t, >= : 'a BinPr.t,
+                           == : 'a BinPr.t, != : 'a BinPr.t}
+   (** Returns a record of relational operators given a compare function. *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/cmp.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/effect.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/effect.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/effect.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,32 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with side-effecting procedures. *)
+signature EFFECT = sig
+   type 'a t = 'a -> unit
+   (** Type of side-effecting procedures. *)
+
+   val ignore : 'a t
+   (** No-operation ({ignore = fn _ => ()}). *)
+
+   val nop : unit t
+   (** No-operation ({nop = fn () => ()}). *)
+
+   val obs : 'a t -> 'a UnOp.t
+   (**
+    * Side-effecting I-combinator ({obs ef x = (ef x ; x)}).  Using {obs}
+    * and {o} you can "attach" side-effects to a function.  The name {obs}
+    * is short for {observe} and comes from the idea that the data is
+    * observed by the effect.
+    *)
+
+   val past : unit t -> 'a UnOp.t
+   (**
+    * Side-effecting I-combinator ({past ef x = (ef () ; x)}).  Using
+    * {past} and {o} you can "attach" side-effects to a function.  The
+    * name {past} comes from the idea that the data flows past the effect.
+    *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/effect.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: mltonlib/trunk/com/ssh/basic/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/export.sml	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/export.sml	2006-11-17 12:38:45 UTC (rev 4829)
@@ -4,4 +4,49 @@
  * See the file MLton-LICENSE for details.
  *)
 
-structure Exit :> EXIT = Exit
+signature BIN_OP = BIN_OP
+signature BIN_PR = BIN_PR
+signature BUFFER = BUFFER
+signature CMP = CMP
+signature EFFECT = EFFECT
+signature EXIT = EXIT
+signature FIX = FIX
+signature FN = FN
+signature ISO = ISO
+signature ORDER = ORDER
+signature PAIR = PAIR
+signature PRODUCT = PRODUCT
+signature PRODUCT_TYPE = PRODUCT_TYPE
+signature READER = READER
+signature REF = REF
+signature SQ = SQ
+signature SUM = SUM
+signature THUNK = THUNK
+signature TIE = TIE
+signature UNIV = UNIV
+signature UN_OP = UN_OP
+signature UN_PR = UN_PR
+signature WRITER = WRITER
+
+structure BinOp : BIN_OP = BinOp
+structure BinPr : BIN_PR = BinPr
+structure Buffer : BUFFER = Buffer
+structure Cmp : CMP = Cmp
+structure Effect : EFFECT = Effect
+structure Exit : EXIT = Exit
+structure Fix : FIX = Fix
+structure Fn : FN = Fn
+structure Iso : ISO = Iso
+structure Order : ORDER = Order
+structure Pair : PAIR = Pair
+structure Product : PRODUCT = Product
+structure Reader : READER = Reader
+structure Ref : REF where type 'a t = 'a ref = Ref
+structure Sq : SQ = Sq
+structure Sum : SUM = Sum
+structure Thunk : THUNK = Thunk
+structure Tie : TIE = Tie
+structure UnOp : UN_OP = UnOp
+structure UnPr : UN_PR = UnPr
+structure Univ : UNIV = Univ
+structure Writer : WRITER = Writer

Added: mltonlib/trunk/com/ssh/basic/unstable/public/fix.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/fix.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/fix.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,14 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with fixpoints. *)
+signature FIX = sig
+   type 'a t = 'a UnOp.t -> 'a
+   (** The type of fixpoint combinators. *)
+
+   exception Fix
+   (** Exception for reporting errors in computing fixpoints. *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/fix.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/fn.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/fn.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/fn.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,68 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with functions. *)
+signature FN = sig
+   type ('a, 'b) t = 'a -> 'b
+   (** The type of functions. *)
+
+   val map : ('c -> 'a) * ('b -> 'd) -> ('a -> 'b) -> 'c -> 'd
+   (** {map (f, g) h = g o h o f}. *)
+
+   val const : 'a -> 'b -> 'a
+   (** K-combinator ({const x y = x}). *)
+
+   val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
+   (** Currying ({curry f x y = f (x, y)}). *)
+
+   val failing : exn -> 'a -> 'b
+   (**
+    * A failing function; {failing e} is equivalent to {fn _ => raise e},
+    * assuming {e} is a variable.
+    *)
+
+   val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
+   (** Flip the order of arguments ({flip f x y = f y x}). *)
+
+   val id : 'a -> 'a
+   (** I-combinator ({id x = x}). *)
+
+   val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
+   (** Uncurrying ({uncurry f (x, y) = f x y}). *)
+
+   val o : ('a -> 'b) * ('c -> 'a) -> 'c -> 'b
+   (** Function composition ({(g o f) x = f (g x)}). *)
+
+   val undefined : 'a -> 'b
+   (**
+    * An undefined function.  This is equivalent to {failing (Fail
+    * "undefined")}.
+    *)
+
+   val <\ : 'a * ('a * 'b -> 'c) -> 'b -> 'c
+   (** Left section ({(x <\ f) y = f (x, y)}). *)
+
+   val \> : ('a -> 'b) * 'a -> 'b
+   (**
+    * Left application ({f \> x1 \> ... \> xN = f x1 ... xN}) and infix
+    * ({x0 <\f1\> x1 ... <\fN\> xN = fN (... f1 (x0, x1) ..., xN)}).
+    *)
+
+   val /> : ('a * 'b -> 'c) * 'b -> 'a -> 'c
+   (** Right section ({(f /> y) x = f (x, y)}). *)
+
+   val </ : 'a * ('a -> 'b) -> 'b
+   (**
+    * Right application ({xN </ ... </ x1 </ f = f x1 ... xN}) and infix
+    * ({xN </fN/> ... x1 </f1/> x0 = fN (xN, ... f1 (x1, x0) ...)}).
+    *)
+
+   val >| : 'a * ('a -> 'b) -> 'b
+   (** Left pipe ({x >| f1 >| ... >| fN = (fN o ... o f1) x}). *)
+
+   val |< : ('a -> 'b) * 'a -> 'b
+   (** Right pipe ({fN |< ... |< f1 |< x = (fN o ... o f1) x}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/fn.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/iso.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/iso.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/iso.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,23 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with isomorphisms. *)
+signature ISO = sig
+   include ISO
+
+   val swap : ('a, 'b) t -> ('b, 'a) t
+
+   val map : ('c, 'a) t * ('b, 'd) t -> ('a, 'b) t -> ('c, 'd) t
+
+   val <--> : ('a, 'b) t * ('c, 'a) t -> ('c, 'b) t
+   (**
+    * Isomorphism composition.
+    *)
+
+   val --> : ('c, 'a) t * ('b, 'd) t -> (('a, 'b) Fn.t, ('c, 'd) Fn.t) t
+   val +` : ('a, 'c) t * ('b, 'd) t -> (('a, 'b) Sum.t, ('c, 'd) Sum.t) t
+   val *` : ('a, 'c) t * ('b, 'd) t -> (('a, 'b) Product.t, ('c, 'd) Product.t) t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/iso.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/order.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/order.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/order.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,35 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with the {order} datatype. *)
+signature ORDER = sig
+   datatype t = datatype order
+   (** The {order} datatype. *)
+
+   val swap : t UnOp.t
+   (**
+    * Swap order:
+    *
+    *> swap EQUAL   = EQUAL
+    *> swap GREATER = LESS
+    *> swap LESS    = GREATER
+    *)
+
+   val orWhenEq : t * t Thunk.t -> t
+   (**
+    * Sequencing of comparisons.  {orWhenEq (a, bTh)} is equivalent to
+    *
+    *> case a of
+    *>    EQUAL => bTh ()
+    *>  | other => other
+    *)
+
+   (** == Predicates == *)
+
+   val isEqual : t UnPr.t    (** {isEqual x = x = EQUAL} *)
+   val isGreater : t UnPr.t  (** {isGreater x = x = GREATER} *)
+   val isLess : t UnPr.t     (** {isLess x = x = LESS} *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/order.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/pair.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/pair.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/pair.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,12 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+signature PAIR = sig
+   type ('a, 'b) pair = 'a * 'b
+
+   include PRODUCT_TYPE
+      where type ('a, 'b) t = ('a, 'b) pair
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/pair.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/product-type.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/product-type.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/product-type.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,69 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+signature PRODUCT_TYPE = sig
+   type ('a, 'b) t
+
+   (** == Conversions == *)
+
+   val fromTuple2 : 'a * 'b -> ('a, 'b) t
+   val fromTuple3 : 'a * 'b * 'c -> (('a, 'b) t, 'c) t
+   val fromTuple4 : 'a * 'b * 'c * 'd -> ((('a, 'b) t, 'c) t, 'd) t
+   (**
+    * Conversions from tuples to products.
+    *)
+
+   val toTuple2 : ('a, 'b) t -> 'a * 'b
+   val toTuple3 : (('a, 'b) t, 'c) t -> 'a * 'b * 'c
+   val toTuple4 : ((('a, 'b) t, 'c) t, 'd) t -> 'a * 'b * 'c * 'd
+   (**
+    * Conversions from products to tuples.
+    *)
+
+   (** == Isomorphisms == *)
+
+   val isoTuple2 : ('a * 'b, ('a, 'b) t) Iso.iso
+   val isoTuple3 : ('a * 'b * 'c, (('a, 'b) t, 'c) t) Iso.iso
+   val isoTuple4 : ('a * 'b * 'c * 'd, ((('a, 'b) t, 'c) t, 'd) t) Iso.iso
+   (**
+    * Isomorphisms between products and tuples.
+    *)
+
+   (** == Operations == *)
+
+   val swap : ('a, 'b) t -> ('b, 'a) t
+   (** Swap the elements of a product. *)
+
+   val swizzle : ('a, 'b) t * ('c, 'd) t -> ('a * 'c, 'b * 'd) t
+   (** Swizzle the elements of a pair of products. *)
+
+   val fst : ('a, 'b) t -> 'a
+   (** Extract the first element of a product. *)
+
+   val snd : ('a, 'b) t -> 'b
+   (** Extract the second element of a product. *)
+
+   (** == HOFs for Building Operations on Products == *)
+
+   val app : 'a Effect.t * 'b Effect.t -> ('a, 'b) t Effect.t
+   val appFst : 'a Effect.t -> ('a, 'b) t Effect.t
+   val appSnd : 'b Effect.t -> ('a, 'b) t Effect.t
+
+   val map : ('a -> 'c) * ('b -> 'd) -> ('a, 'b) t -> ('c, 'd) t
+   val mapFst : ('a -> 'c) -> ('a, 'b) t -> ('c, 'b) t
+   val mapSnd : ('b -> 'c) -> ('a, 'b) t -> ('a, 'c) t
+
+   val all : 'a UnPr.t * 'b UnPr.t -> ('a, 'b) t UnPr.t
+   val exists : 'a UnPr.t * 'b UnPr.t -> ('a, 'b) t UnPr.t
+
+   val equal : 'a BinPr.t * 'b BinPr.t -> ('a, 'b) t BinPr.t
+   val collate : 'a Cmp.t * 'b Cmp.t -> ('a, 'b) t Cmp.t
+
+   val foldl : ('a * 'x -> 'y) * ('b * 'y -> 'z) -> ('a, 'b) t * 'x -> 'z
+   val foldr : ('a * 'y -> 'z) * ('b * 'x -> 'y) -> ('a, 'b) t * 'x -> 'z
+
+   val thunk : 'a Thunk.t * 'b Thunk.t -> ('a, 'b) t Thunk.t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/product-type.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/product.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/product.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/product.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,18 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(**
+ * A general purpose product datatype.
+ *
+ * A product datatype is useful for reducing the inconvenience of matching
+ * nested products in combinator libraries (e.g. parser combinators).
+ *)
+signature PRODUCT = sig
+   datatype ('a, 'b) product = & of 'a * 'b
+
+   include PRODUCT_TYPE
+      where type ('a, 'b) t = ('a, 'b) product
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/product.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/reader.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/reader.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/reader.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,27 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with readers. *)
+signature READER = sig
+   type ('a, 'b) t = 'b -> ('a * 'b) Option.t
+
+   (** == Monad Interface == *)
+
+   val return : 'a -> ('a, 's) t
+   val >>= : ('a, 's) t * ('a -> ('b, 's) t) -> ('b, 's) t
+
+   (** == Useful Combinators == *)
+
+   val map : ('a -> 'b) -> ('a, 's) t -> ('b, 's) t
+   val >>& : ('a, 's) t * ('b, 's) t -> (('a, 'b) Product.t, 's) t
+
+   (** == Typing == *)
+
+   type univ
+   type 'a u = ('a, univ) t
+
+   val polymorphically : ('a u -> 'b u) -> ('a, 's) t -> ('b, 's) t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/reader.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/ref.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/ref.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/ref.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,61 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with references. *)
+signature REF = sig
+   type 'a t
+   (**
+    * The type of references.  This is left abstract to allow for
+    * different types of references.  In particular, in addition to the
+    * built-in references of SML, one could implement, in a suitable
+    * extension to SML, a type of references whose various operations
+    * would be guaranteed to be atomic.
+    *)
+
+   val new : 'a -> 'a t
+   (** Creates a new reference to the given value. *)
+
+   val ! : 'a t -> 'a
+   (** Returns the value referred to by the given reference. *)
+
+   val := : ('a t * 'a) Effect.t
+   (** {r := v} makes the reference {r} refer to the value {v}.  *)
+
+   val :=: : 'a t Sq.t Effect.t
+   (**
+    * Swaps the values referred to by the given references.  Ignoring
+    * concurrency, {r1 :=: r2} is equivalent to
+    *
+    *> let
+    *>    val v1 = !r1
+    *>    val v2 = !r2
+    *> in
+    *>    r1 := v2
+    *>  ; r2 := v1
+    *> end
+    *)
+
+   val exchange : 'a t * 'a -> 'a
+   (**
+    * Ignoring concurrency, {exchange (r, v)} is equivalent to {!r before
+    * r := v}.
+    *)
+
+   val app : 'a Effect.t -> 'a t Effect.t
+   (** {app ef r} is equivalent to {ef (!r)}. *)
+
+   val map : ('a -> 'b) -> 'a t -> 'b t
+   (** {map f r} is equivalent to {new (f (!r))}. *)
+
+   val modify : 'a UnOp.t -> 'a t Effect.t
+   (** Ignoring concurrency, {modify f r} is equivalent to {r := f (!r)}. *)
+
+   val equal : 'a t BinPr.t
+   (**
+    * Returns true if the given references were, in fact, created by a
+    * single call to {new}.  This is equivalent to {op =}.
+    *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/ref.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/sq.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/sq.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/sq.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,17 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(**
+ * Utilities for dealing with "squares", that is, pairs whose both
+ * elements are of the same type.
+ *)
+signature SQ = sig
+   type 'a t = 'a * 'a
+   (** The type of "squares". *)
+
+   val mk : 'a -> 'a t
+   (** {mk x = (x, x)}. *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/sq.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/sum.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/sum.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/sum.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,41 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(**
+ * A general purpose sum type.
+ *)
+signature SUM = sig
+   datatype ('a, 'b) sum = INL of 'a | INR of 'b
+   type ('a, 'b) t = ('a, 'b) sum
+
+   exception Sum
+
+   val sum : ('a -> 'c) * ('b -> 'c) -> ('a, 'b) t -> 'c
+
+   val swap : ('a, 'b) t -> ('b, 'a) t
+
+   val out : ('x, 'x) t -> 'x
+
+   val app : 'a Effect.t * 'b Effect.t -> ('a, 'b) t Effect.t
+
+   val map : ('a -> 'c) * ('b -> 'd) -> ('a, 'b) t -> ('c, 'd) t
+
+   val isL : ('a, 'b) t UnPr.t
+   val isR : ('a, 'b) t UnPr.t
+
+   val outL : ('a, 'b) t -> 'a
+   val outR : ('a, 'b) t -> 'b
+
+   val getL : ('a, 'b) t -> 'a UnOp.t
+   val getR : ('a, 'b) t -> 'b UnOp.t
+
+   val mapL : ('a -> 'c) -> ('a, 'b) t -> ('c, 'b) t
+   val mapR : ('b -> 'd) -> ('a, 'b) t -> ('a, 'd) t
+
+   val equal : 'a BinPr.t * 'b BinPr.t -> ('a, 'b) t BinPr.t
+
+   val collate : 'a Cmp.t * 'b Cmp.t -> ('a, 'b) t Cmp.t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/sum.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/thunk.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/thunk.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/thunk.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,14 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with thunks. *)
+signature THUNK = sig
+   type 'a t = unit -> 'a
+   (** The type of thunks or suspended computations (e.g. {fn () => exp}). *)
+
+   val mk : 'a -> 'a t
+   (** Constant thunk ({thunk x = let val x = x in fn () => x end}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/thunk.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/tie.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/tie.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/tie.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,89 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(**
+ * A framework for computing fixpoints.
+ *
+ * In a strict language you sometimes want to provide a fixpoint
+ * combinator for an abstract type {t} to make it possible to write
+ * recursive definitions.  Unfortunately, a single combinator {fix} of the
+ * type {(t -> t) -> t} does not support mutual recursion.  To support
+ * mutual recursion, you would need to provide a family of fixpoint
+ * combinators having types of the form {(u -> u) -> u} where {u} is a
+ * type of the form {t * ... * t}.  Unfortunately, even such a family of
+ * fixpoint combinators does not support mutual recursion over different
+ * abstract types.
+ *
+ * See also: http://mlton.org/Fixpoints
+ *)
+signature TIE = sig
+   type 'a t_domain
+   type 'a t_range
+   type 'a t = 'a t_domain -> 'a t_range
+   (**
+    * The type of fixpoint tiers.
+    *
+    * The type constructors {t_domain} and {t_range} are used to expose
+    * the arrow {->} type constructor (to allow eta-expansion) while
+    * preventing clients from actually applying tiers.
+    *)
+
+   val fix : 'a t -> 'a Fix.t
+   (**
+    * Produces a fixpoint combinator from the given tier.  For example,
+    * given a module {Fn} implementing a tier {Fn.Y} for functions, one
+    * could make a mutually recursive definition of functions:
+    *
+    *> val isEven & isOdd =
+    *>     let open Tie in fix (Fn *` Fn) end
+    *>        (fn isEven & isOdd =>
+    *>            (fn 0w0 => true
+    *>              | 0w1 => false
+    *>              | n => isOdd (n-0w1)) &
+    *>            (fn 0w0 => false
+    *>              | 0w1 => true
+    *>              | n => isEven (n-0w1)))
+    *)
+
+   val pure : ('a * 'a UnOp.t) Thunk.t -> 'a t
+   (**
+    * {pure} is a more general version of {tier}.  It is mostly useful for
+    * computing fixpoints in a non-imperative manner.
+    *)
+
+   val tier : ('a * 'a Effect.t) Thunk.t -> 'a t
+   (**
+    * {tier} is used to define fixpoint tiers for new abstract types by
+    * providing a thunk whose instantiation allocates a fresh "knot" and a
+    * procedure for "tying" it.
+    *)
+
+   val iso : 'b t -> ('a, 'b) Iso.t -> 'a t
+   (**
+    * Given an isomorphism between {'a} and {'b} and a tier for {'b},
+    * produces a tier for {'a}.  This is useful when you have a new type
+    * that is isomorphic to some old type for which you already have a
+    * tier.
+    *)
+
+   val *` : 'a t * 'b t -> ('a, 'b) Product.t t
+   (**
+    * Given tiers for {'a} and {'b} produces a tier for the product {('a,
+    * 'b) Product.t}.  This is used when mutual recursion is needed.
+    *)
+
+   val tuple2 : 'a t * 'b t -> ('a * 'b) t
+   (**
+    * Given tiers for {'a} and {'b} produces a tier for the product {'a *
+    * 'b}.
+    *)
+
+   val option : 'a option t
+   (** Tier for options. *)
+
+   val function : ('a -> 'b) t
+   (** Tier for functions. *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/tie.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/un-op.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/un-op.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/un-op.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,11 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with unary operators. *)
+signature UN_OP = sig
+   type 'a t = 'a -> 'a
+   (** Type of unary operators (e.g. {~, rev, ...}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/un-op.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/un-pr.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/un-pr.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/un-pr.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,20 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with (unary) predicates. *)
+signature UN_PR = sig
+   type 'a t = 'a -> bool
+   (** Type of (unary) predicates (e.g. {null, isSome, ...}). *)
+
+   val andAlso : 'a t BinOp.t
+   (** Conjunction of predicates ({(p andAlso q) x = p x andalso q y}). *)
+
+   val negate : 'a t UnOp.t
+   (** Predicate negation ({negate p = not o p}). *)
+
+   val orElse : 'a t BinOp.t
+   (** Disjunction of predicates ({(p orElse q) x = p x orelse q x}). *)
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/un-pr.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/univ.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/univ.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/univ.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,13 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Signature for a basic universal type. *)
+signature UNIV = sig
+   type t
+
+   val newIso : ('a, t) Iso.t Thunk.t
+   val newEmb : ('a, t) Emb.t Thunk.t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/univ.sig
___________________________________________________________________
Name: svn:eol-style
   + native

Added: mltonlib/trunk/com/ssh/basic/unstable/public/writer.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/writer.sig	2006-11-16 11:19:34 UTC (rev 4828)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/writer.sig	2006-11-17 12:38:45 UTC (rev 4829)
@@ -0,0 +1,21 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(** Utilities for dealing with writers. *)
+signature WRITER = sig
+   type ('a, 'b) t = 'a * 'b -> 'b
+
+   (** == Useful Combinators == *)
+
+   val map : ('b -> 'a) -> ('a, 's) t -> ('b, 's) t
+
+   (** == Typing == *)
+
+   type univ
+   type 'a u = ('a, univ) t
+
+   val polymorphically : ('a u -> 'b u) -> ('a, 's) t -> ('b, 's) t
+end


Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/writer.sig
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the MLton-commit mailing list