[MLton-commit] r5542

Vesa Karvonen vesak at mlton.org
Tue May 1 14:47:47 PDT 2007


Separated the shiftable concept from the bitwise concept and made bool an
instance of bitwise.

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

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm
U   mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig
A   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/shiftable.sig
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml	2007-05-01 21:47:46 UTC (rev 5542)
@@ -1,4 +1,4 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+(* Copyright (C) 2006-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.
@@ -7,6 +7,7 @@
 structure Bool : BOOL = struct
    structure Core = struct
       open Bool
+      type bitwise = t
       type bounded = t
       type ordered = t
       type scannable = t
@@ -16,6 +17,10 @@
       val compare = fn (false, true) => LESS
                      | (true, false) => GREATER
                      | (_,        _) => EQUAL
+      fun andb (b1, b2) = b1 andalso b2
+      val notb = not
+      fun orb (b1, b2) = b1 orelse b2
+      val xorb = op <>
    end
 
    structure Bounded = MkBounded (Core)
@@ -29,7 +34,4 @@
    open Stringable
 
    open Core
-
-   fun orb (b1, b2) = b1 orelse b2
-   fun andb (b1, b2) = b1 andalso b2
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm	2007-05-01 21:47:46 UTC (rev 5542)
@@ -19,6 +19,7 @@
    ../../../public/concept/monad.sig
    ../../../public/concept/ordered.sig
    ../../../public/concept/scannable.sig
+   ../../../public/concept/shiftable.sig
    ../../../public/concept/signed.sig
    ../../../public/concept/stringable.sig
    ../../../public/control/exit.sig

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2007-05-01 21:47:46 UTC (rev 5542)
@@ -55,6 +55,7 @@
          public/concept/monad.sig
          public/concept/ordered.sig
          public/concept/scannable.sig
+         public/concept/shiftable.sig
          public/concept/signed.sig
          public/concept/stringable.sig
 

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig	2007-05-01 21:47:46 UTC (rev 5542)
@@ -5,11 +5,8 @@
  *)
 
 (**
- * A bitwise operable type can be treated as a sequence of bits.  The
- * sequence of bits may be finite or infinite.  In an infinite sequence,
- * the most significant (or leftmost) bits are either all zeros or all
- * ones.  Zero extending shift operator, {>>}, does not work with such
- * infinite bit sequences and is not specified.
+ * A bitwise operable type can be treated as a set of bits.  The set of
+ * bits may be finite or infinite.
  *)
 signature BITWISE = sig
    type bitwise
@@ -28,18 +25,4 @@
 
    val xorb : bitwise BinOp.t
    (** Returns the bitwise exclusive OR of the arguments. *)
-
-   val << : bitwise ShiftOp.t
-   (**
-    * {i << n} shifts {i} to the left by {n} bit positions, filling in
-    * zeros from the right.  When {i} and {n} are interpreted as integers,
-    * the latter non-negative, this returns {i * 2^n}.
-    *)
-
-   val ~>> : bitwise ShiftOp.t
-   (**
-    * {i ~>> n} shifts {i} to the right by {n} bit positions.  When {i}
-    * and {n} are interpreted as integers, the latter non-negative, this
-    * returns {floor (i / 2^n)}.
-    *)
 end

Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/shiftable.sig (from rev 5541, mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig)
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/bitwise.sig	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/shiftable.sig	2007-05-01 21:47:46 UTC (rev 5542)
@@ -0,0 +1,30 @@
+(* 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.
+ *)
+
+(**
+ * A shiftable type can be shifted like a sequence of bits.  The sequence
+ * of bits may be finite or infinite.  In an infinite sequence, the most
+ * significant (or leftmost) bits are either all zeros or all ones.  Zero
+ * extending shift operator, {>>}, does not work with such infinite bit
+ * sequences and is not specified.
+ *)
+signature SHIFTABLE = sig
+   type shiftable
+
+   val << : shiftable ShiftOp.t
+   (**
+    * {i << n} shifts {i} to the left by {n} bit positions, filling in
+    * zeros from the right.  When {i} and {n} are interpreted as integers,
+    * the latter non-negative, this returns {i * 2^n}.
+    *)
+
+   val ~>> : shiftable ShiftOp.t
+   (**
+    * {i ~>> n} shifts {i} to the right by {n} bit positions.  When {i}
+    * and {n} are interpreted as integers, the latter non-negative, this
+    * returns {floor (i / 2^n)}.
+    *)
+end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig	2007-05-01 21:47:46 UTC (rev 5542)
@@ -1,4 +1,4 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+(* Copyright (C) 2006-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.
@@ -14,12 +14,6 @@
    val not : t UnOp.t
    (** Logical negation. *)
 
-   val orb : t BinOp.t
-   (** Logical disjunction *)
-
-   val andb : t BinOp.t
-   (** Logical conjunction *)
-
    val isTrue : t UnPr.t
    (** {isTrue x = x = true} *)
 
@@ -28,6 +22,7 @@
 
    (** == Concepts == *)
 
+   include BITWISE where type bitwise = t
    include BOUNDED where type bounded = t
    include ORDERED where type ordered = t
    include SCANNABLE where type scannable = t

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml	2007-04-30 03:28:24 UTC (rev 5541)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml	2007-05-01 21:47:46 UTC (rev 5542)
@@ -24,18 +24,19 @@
 signature MONAD = MONAD
 signature MONADP = MONADP
 signature MONADP_CORE = MONADP_CORE
+signature MONADP_EX = MONADP_EX
+signature MONADP_STATE = MONADP_STATE
 signature MONAD_CORE = MONAD_CORE
 signature MONAD_EX = MONAD_EX
-signature MONADP_EX = MONADP_EX
+signature MONAD_STATE = MONAD_STATE
 signature MONAD_WS = MONAD_WS
-signature MONAD_STATE = MONAD_STATE
-signature MONADP_STATE = MONADP_STATE
 signature ORDERED = ORDERED
 signature ORDERED_CORE = ORDERED_CORE
 signature SCANNABLE = SCANNABLE
 signature SCANNABLE_CORE = SCANNABLE_CORE
 signature SCANNABLE_FROM_FORMAT = SCANNABLE_FROM_FORMAT
 signature SCANNABLE_FROM_FORMAT_CORE = SCANNABLE_FROM_FORMAT_CORE
+signature SHIFTABLE = SHIFTABLE
 signature SIGNED = SIGNED
 signature STRINGABLE = STRINGABLE
 signature STRINGABLE_CORE = STRINGABLE_CORE




More information about the MLton-commit mailing list