[MLton-commit] r4913

Vesa Karvonen vesak at mlton.org
Sat Dec 9 23:48:10 PST 2006


Added Univ exception and wrote a bit of documentation.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/bootstrap.cm
A   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-common.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-exn.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-ref.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
U   mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/univ.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/bootstrap.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/bootstrap.cm	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/bootstrap.cm	2006-12-10 07:48:08 UTC (rev 4913)
@@ -9,4 +9,5 @@
    source(-)
 is
    ../bootstrap.sml
+   ../univ-common.sml
    workarounds/basis.cm

Added: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-common.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-common.sml	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-common.sml	2006-12-10 07:48:08 UTC (rev 4913)
@@ -0,0 +1,9 @@
+(* Copyright (C) 2006 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 Univ = struct
+   exception Univ
+end


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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-exn.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-exn.sml	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-exn.sml	2006-12-10 07:48:08 UTC (rev 4913)
@@ -5,12 +5,14 @@
  *)
 
 structure UnivExn :> UNIV = struct
+   open Univ
+
    type t = Exn.t
 
    fun newIso () = let
       exception U of 'a
    in
-      (U, fn U ? => ? | _ => raise Match)
+      (U, fn U ? => ? | _ => raise Univ)
    end
 
    fun newEmb () = let

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-ref.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-ref.sml	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/univ-ref.sml	2006-12-10 07:48:08 UTC (rev 4913)
@@ -5,6 +5,8 @@
  *)
 
 structure UnivRef :> UNIV = struct
+   open Univ
+
    datatype t =
       IN of {clear : unit -> unit,
              store : unit -> unit}
@@ -20,7 +22,7 @@
              deref ((store () ; !r) before clear ()))
       end
    in
-      fun newIso () = mk (fn SOME ? => ? | NONE => raise Match)
+      fun newIso () = mk (fn SOME ? => ? | NONE => raise Univ)
       fun newEmb () = mk (fn ? => ?)
    end
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2006-12-10 07:48:08 UTC (rev 4913)
@@ -50,6 +50,7 @@
          basis Univ = bas
             public/univ.sig
             local
+               detail/univ-common.sml
                ann "warnUnused false" in
                   detail/univ-ref.sml
                   detail/univ-exn.sml

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use	2006-12-10 07:48:08 UTC (rev 4913)
@@ -19,7 +19,7 @@
         "public/sq.sig", "detail/sq.sml",
         "public/un-op.sig", "detail/un-op.sml",
         "public/thunk.sig", "detail/thunk.sml",
-        "public/univ.sig", "detail/univ-exn.sml",
+        "public/univ.sig", "detail/univ-common.sml", "detail/univ-exn.sml",
         "public/bin-op.sig", "detail/bin-op.sml",
         "public/effect.sig", "detail/effect.sml",
         "public/fix.sig", "detail/fix.sml",

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/univ.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/univ.sig	2006-12-08 22:52:19 UTC (rev 4912)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/univ.sig	2006-12-10 07:48:08 UTC (rev 4913)
@@ -4,10 +4,29 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-(** Signature for a basic universal type. *)
+(**
+ * Signature for a basic universal type.
+ *
+ * See also: [http://mlton.org/UniversalType]
+ *)
 signature UNIV = sig
    type t
+   (** The universal type. *)
 
+   exception Univ
+   (** Raised in case of a mismatched projection. *)
+
    val newIso : ('a, t) Iso.t Thunk.t
+   (**
+    * Creates a new embedding of an arbitrary type {'a} to the universal
+    * type {t} and returns it as an isomorphism whose projection function
+    * is partial.  The projection function raises {Univ} in case of a
+    * mismatch.
+    *)
+
    val newEmb : ('a, t) Emb.t Thunk.t
+   (**
+    * Creates a new embedding of an arbitrary type {'a} to the universal
+    * type {t}.
+    *)
 end




More information about the MLton-commit mailing list