[MLton-commit] r5577
Vesa Karvonen
vesak at mlton.org
Mon May 28 20:45:51 PDT 2007
Added Bool.toInt.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig
U mltonlib/trunk/com/ssh/misc-util/unstable/arbitrary.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-05-28 20:21:56 UTC (rev 5576)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/data/bool.sml 2007-05-29 03:45:50 UTC (rev 5577)
@@ -21,6 +21,7 @@
val notb = not
fun orb (b1, b2) = b1 orelse b2
val xorb = op <>
+ val toInt = fn true => 1 | false => 0
end
structure Bounded = MkBounded (Core)
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig 2007-05-28 20:21:56 UTC (rev 5576)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/bool.sig 2007-05-29 03:45:50 UTC (rev 5577)
@@ -21,6 +21,9 @@
val isFalse : t UnPr.t
(** {isFalse x = x = false} *)
+ val toInt : t -> Int.t
+ (** {toInt true = 1} and {toInt false = 0}. *)
+
(** == Concepts == *)
include BITWISE where type bitwise = t
Modified: mltonlib/trunk/com/ssh/misc-util/unstable/arbitrary.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/arbitrary.sml 2007-05-28 20:21:56 UTC (rev 5576)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/arbitrary.sml 2007-05-29 03:45:50 UTC (rev 5577)
@@ -61,7 +61,7 @@
val unit = IN {gen = G.return (), cog = const (G.variant 0), typ = Typ.unit}
val bool = IN {gen = G.bool,
- cog = G.variant o (fn true => 1 | false => 0),
+ cog = G.variant o Bool.toInt,
typ = Typ.bool}
val int = IN {gen = map (fn w => W.toIntX (w - G.RNG.maxValue div 0w2))
(* XXX result may not fit an Int.int *)
More information about the MLton-commit
mailing list