[MLton-commit] r6946

Vesa Karvonen vesak at mlton.org
Fri Oct 17 12:40:45 PDT 2008


Changed to avoid using incomplete pattern matches to silence warnings on
compilers other than MLton (as much as I prefer the brevity of not
requiring a complete match in a case such as this).

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

U   mltonlib/trunk/com/ssh/generic/unstable/detail/extra/reg-basis-exns.fun
U   mltonlib/trunk/com/ssh/generic/unstable/lib.mlb

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

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/extra/reg-basis-exns.fun
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/extra/reg-basis-exns.fun	2008-10-17 08:43:14 UTC (rev 6945)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/extra/reg-basis-exns.fun	2008-10-17 19:40:39 UTC (rev 6946)
@@ -8,39 +8,38 @@
    val () = let
       open Generics (*IEEEReal*) OS OS.IO OS.Path Time
 
-      local
-         fun lift f a = SOME (f a) handle Match => NONE
-      in
-         fun regExn0' n e p = regExn0 (C n) (e, lift p)
-         fun regExn1' n t e p = regExn1 (C n) t (e, lift p)
-      end
+      val n = NONE
+      val s = SOME
+
+      fun reg0 n e p = regExn0 (C n) (e, p)
+      fun reg1 n t e p = regExn1 (C n) t (e, p)
    in
       (* Handlers for most standard exceptions: *)
-      regExn0' "Bind"               Bind         (fn Bind         => ())
-    ; regExn0' "Chr"                Chr          (fn Chr          => ())
-    ; regExn0' "Date.Date"          Date.Date    (fn Date.Date    => ())
-    ; regExn0' "Div"                Div          (fn Div          => ())
-    ; regExn0' "Domain"             Domain       (fn Domain       => ())
-    ; regExn0' "Empty"              Empty        (fn Empty        => ())
-    ; regExn0' "OS.Path.InvalidArc" InvalidArc   (fn InvalidArc   => ())
-    ; regExn0' "Match"              Match        (fn Match        => ())
-    ; regExn0' "Option"             Option       (fn Option       => ())
-    ; regExn0' "Overflow"           Overflow     (fn Overflow     => ())
-    ; regExn0' "OS.Path.Path"       Path         (fn Path         => ())
+      reg0 "Bind"               Bind         (fn Bind         => s() | _ => n)
+    ; reg0 "Chr"                Chr          (fn Chr          => s() | _ => n)
+    ; reg0 "Date.Date"          Date.Date    (fn Date.Date    => s() | _ => n)
+    ; reg0 "Div"                Div          (fn Div          => s() | _ => n)
+    ; reg0 "Domain"             Domain       (fn Domain       => s() | _ => n)
+    ; reg0 "Empty"              Empty        (fn Empty        => s() | _ => n)
+    ; reg0 "OS.Path.InvalidArc" InvalidArc   (fn InvalidArc   => s() | _ => n)
+    ; reg0 "Match"              Match        (fn Match        => s() | _ => n)
+    ; reg0 "Option"             Option       (fn Option       => s() | _ => n)
+    ; reg0 "Overflow"           Overflow     (fn Overflow     => s() | _ => n)
+    ; reg0 "OS.Path.Path"       Path         (fn Path         => s() | _ => n)
 (*
-    ; regExn0' "OS.IO.Poll"         Poll         (fn Poll         => ())
+    ; reg0 "OS.IO.Poll"         Poll         (fn Poll         => s() | _ => n)
 *)
-    ; regExn0' "Size"               Size         (fn Size         => ())
-    ; regExn0' "Span"               Span         (fn Span         => ())
-    ; regExn0' "Subscript"          Subscript    (fn Subscript    => ())
-    ; regExn0' "Time.Time"          Time         (fn Time         => ())
+    ; reg0 "Size"               Size         (fn Size         => s() | _ => n)
+    ; reg0 "Span"               Span         (fn Span         => s() | _ => n)
+    ; reg0 "Subscript"          Subscript    (fn Subscript    => s() | _ => n)
+    ; reg0 "Time.Time"          Time         (fn Time         => s() | _ => n)
 (*
-    ; regExn0' "IEEEReal.Unordered" Unordered    (fn Unordered    => ())
+    ; reg0 "IEEEReal.Unordered" Unordered    (fn Unordered    => s() | _ => n)
 *)
-    ; regExn1' "Fail" string        Fail         (fn Fail       ? =>  ?)
+    ; reg1 "Fail" string        Fail         (fn Fail       ? => s ? | _ => n)
       (* Handlers for some extended-basis exceptions: *)
-    ; regExn0' "IOSMonad.EOS"       IOSMonad.EOS (fn IOSMonad.EOS => ())
-    ; regExn0' "Sum.Sum"            Sum.Sum      (fn Sum.Sum      => ())
-    ; regExn0' "Fix.Fix"            Fix.Fix      (fn Fix.Fix      => ())
+    ; reg0 "IOSMonad.EOS"       IOSMonad.EOS (fn IOSMonad.EOS => s() | _ => n)
+    ; reg0 "Sum.Sum"            Sum.Sum      (fn Sum.Sum      => s() | _ => n)
+    ; reg0 "Fix.Fix"            Fix.Fix      (fn Fix.Fix      => s() | _ => n)
    end
 end

Modified: mltonlib/trunk/com/ssh/generic/unstable/lib.mlb
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/lib.mlb	2008-10-17 08:43:14 UTC (rev 6945)
+++ mltonlib/trunk/com/ssh/generic/unstable/lib.mlb	2008-10-17 19:40:39 UTC (rev 6946)
@@ -134,9 +134,7 @@
 
          detail/extra/close-pretty-with-extra.fun
 
-         ann "nonexhaustiveExnMatch ignore" in
-            detail/extra/reg-basis-exns.fun
-         end
+         detail/extra/reg-basis-exns.fun
       in
          public/export.sml
       end




More information about the MLton-commit mailing list