[MLton-commit] r5915

Vesa Karvonen vesak at mlton.org
Tue Aug 21 07:02:31 PDT 2007


Only indentation/formatting changes.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/arbitrary.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/hash.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/pretty.sml
U   mltonlib/trunk/com/ssh/generic/unstable/detail/value/some.sml

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

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/arbitrary.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/arbitrary.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/arbitrary.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -65,10 +65,10 @@
          val gen = G.frequency [(Arg.numAlts aS, aGen),
                                 (Arg.numAlts bS, bGen)]
          val gen0 =
-             case Arg.hasBaseCase aS & Arg.hasBaseCase bS of
-                true & false => aGen
-              | false & true => bGen
-              | _            => gen
+             case Arg.hasBaseCase aS & Arg.hasBaseCase bS
+              of true  & false => aGen
+               | false & true  => bGen
+               | _             => gen
       in
          IN {gen = G.sized (fn 0 => gen0 | _ => gen),
              cog = fn INL a => G.variant 0w0 o cogS aS a

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/eq.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -60,10 +60,10 @@
       fun regExn t (_, e2to) =
           Ref.modify (fn exnHandler =>
                          fn (l, r) =>
-                            case e2to l & e2to r of
-                               NONE   & NONE   => exnHandler (l, r)
-                             | SOME l & SOME r => t (l, r)
-                             | _               => false) exnHandler
+                            case e2to l & e2to r
+                             of NONE   & NONE   => exnHandler (l, r)
+                              | SOME l & SOME r => t (l, r)
+                              | _               => false) exnHandler
       fun exn ? = !exnHandler ?
 
       val list = ListPair.allEq

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/hash.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/hash.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/hash.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -80,33 +80,33 @@
          fun len n []      = n
            | len n (_::xs) = if m <= n then n else len (n+1) xs
       in
-         case len 0 xs of
-            0 => 0wx2A4C7A
-          | n => let
-               val p = {totWidth = Int.quot (totWidth, n),
-                        maxDepth = maxDepth - 1}
-               fun lp h _ []      = h
-                 | lp h n (x::xs) =
-                   if n = 0 then h else lp (h * 0w17 + getT xT x p) (n-1) xs
-            in
-               lp (Word.fromInt n) n xs
-            end
+         case len 0 xs
+          of 0 => 0wx2A4C7A
+           | n => let
+                val p = {totWidth = Int.quot (totWidth, n),
+                         maxDepth = maxDepth - 1}
+                fun lp h _ []      = h
+                  | lp h n (x::xs) =
+                    if n = 0 then h else lp (h * 0w17 + getT xT x p) (n-1) xs
+             in
+                lp (Word.fromInt n) n xs
+             end
       end
 
       fun hashSeq length sub hashElem s {totWidth, maxDepth} = let
          val n = length s
          val h = Word.fromInt n
       in
-         case Int.min (Int.quot (totWidth+3, 4), Int.quot (n+1, 2)) of
-            0          => h
-          | numSamples => let
-               val p = {totWidth = Int.quot (totWidth, numSamples),
-                        maxDepth = maxDepth - 1}
-               fun lp h 0 = h
-                 | lp h n = lp (h * 0w19 + hashElem (sub (s, n-1)) p) (n-1)
-            in
-               lp h (Int.max (numSamples, Int.min (10, n)))
-            end
+         case Int.min (Int.quot (totWidth+3, 4), Int.quot (n+1, 2))
+          of 0          => h
+           | numSamples => let
+                val p = {totWidth = Int.quot (totWidth, numSamples),
+                         maxDepth = maxDepth - 1}
+                fun lp h 0 = h
+                  | lp h n = lp (h * 0w19 + hashElem (sub (s, n-1)) p) (n-1)
+             in
+                lp h (Int.max (numSamples, Int.min (10, n)))
+             end
       end
 
       fun array  aT = hashSeq Array.length  Array.sub  (getT aT)

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/ord.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -18,11 +18,11 @@
 
    fun seq {toSlice, getItem} aO (e, (l, r)) = let
       fun lp (e, l, r) =
-          case (getItem l, getItem r)
-           of (NONE       , NONE       ) => (e, EQUAL)
-            | (NONE       , SOME _     ) => (e, LESS)
-            | (SOME _     , NONE       ) => (e, GREATER)
-            | (SOME (x, l), SOME (y, r)) =>
+          case getItem l & getItem r
+           of NONE        & NONE        => (e, EQUAL)
+            | NONE        & SOME _      => (e, LESS)
+            | SOME _      & NONE        => (e, GREATER)
+            | SOME (x, l) & SOME (y, r) =>
               case aO (e, (x, y))
                of (e, EQUAL) => lp (e, l, r)
                 | result     => result
@@ -67,11 +67,11 @@
       val record = id
 
       fun op +` (aO, bO) (e, (l, r)) =
-          case (l, r)
-           of (INL l, INL r) => aO (e, (l, r))
-            | (INL _, INR _) => (e, LESS)
-            | (INR _, INL _) => (e, GREATER)
-            | (INR l, INR r) => bO (e, (l, r))
+          case l & r
+           of INL l & INL r => aO (e, (l, r))
+            | INL _ & INR _ => (e, LESS)
+            | INR _ & INL _ => (e, GREATER)
+            | INR l & INR r => bO (e, (l, r))
       val unit  = lift (fn ((), ()) => EQUAL)
       fun C0 _  = unit
       fun C1 _  = id
@@ -87,17 +87,17 @@
              fn i =>
                 if i = Buffer.length exns
                 then GenericsUtil.failExnSq lr
-                else case Buffer.sub (exns, i) (e, lr) of
-                        SOME r => r
-                      | NONE   => lp (i+1))
+                else case Buffer.sub (exns, i) (e, lr)
+                      of SOME r => r
+                       | NONE   => lp (i+1))
       fun regExn aO (_, e2a) =
           (Buffer.push exns)
              (fn (e, (l, r)) =>
-                 case e2a l & e2a r of
-                    SOME l & SOME r => SOME (aO (e, (l, r)))
-                  | SOME _ & NONE   => SOME (e, GREATER)
-                  | NONE   & SOME _ => SOME (e, LESS)
-                  | NONE   & NONE   => NONE)
+                 case e2a l & e2a r
+                  of SOME l & SOME r => SOME (aO (e, (l, r)))
+                   | SOME _ & NONE   => SOME (e, GREATER)
+                   | NONE   & SOME _ => SOME (e, LESS)
+                   | NONE   & NONE   => NONE)
 
       fun array ? = cyclic (seq {toSlice = ArraySlice.full,
                                  getItem = ArraySlice.getItem} ?)

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/pretty.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/pretty.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/pretty.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -112,9 +112,9 @@
           ref (txt o "#" <\ op ^ o General.exnName o #2)
       fun regExn t (_, prj) =
           Ref.modify (fn exn => fn (env, e) =>
-                                   case prj e of
-                                      NONE => exn (env, e)
-                                    | SOME x => t (env, x)) exn
+                         case prj e
+                          of NONE   => exn (env, e)
+                           | SOME x => t (env, x)) exn
       val exn = fn ? => !exn ?
 
       val txtAs = txt "as"

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/some.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/some.sml	2007-08-21 13:33:36 UTC (rev 5914)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/some.sml	2007-08-21 14:02:30 UTC (rev 5915)
@@ -7,6 +7,7 @@
 functor WithSome (Arg : WITH_SOME_DOM) : SOME_CASES = struct
    (* <-- SML/NJ workaround *)
    open TopLevel
+   infix 0 &
    (* SML/NJ workaround --> *)
 
    structure Some = LayerRep
@@ -40,10 +41,10 @@
          val b = getS bS
       in
          (* We are careful here to avoid diverging. *)
-         case (Arg.hasBaseCase aS, Arg.hasBaseCase bS) of
-            (true, false) => INL o a
-          | (false, true) => INR o b
-          | _             => fn () => INL (a ()) handle _ => INR (b ())
+         case Arg.hasBaseCase aS & Arg.hasBaseCase bS
+          of true  & false => INL o a
+           | false & true  => INR o b
+           | _             => fn () => INL (a ()) handle _ => INR (b ())
       end
       val unit = fn () => ()
       fun C0 _ = unit




More information about the MLton-commit mailing list