[MLton-commit] r4994

Vesa Karvonen vesak at mlton.org
Thu Dec 21 13:21:58 PST 2006


Added map to UnPr and BinPr.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bin-pr.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/un-pr.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/bin-pr.sig
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/un-pr.sig

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

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bin-pr.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bin-pr.sml	2006-12-20 21:05:44 UTC (rev 4993)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bin-pr.sml	2006-12-21 21:21:56 UTC (rev 4994)
@@ -6,4 +6,5 @@
 
 structure BinPr :> BIN_PR = struct
    open BinPr
+   fun map f = UnPr.map (Sq.map f)
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/un-pr.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/un-pr.sml	2006-12-20 21:05:44 UTC (rev 4993)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/un-pr.sml	2006-12-21 21:21:56 UTC (rev 4994)
@@ -6,6 +6,7 @@
 
 structure UnPr :> UN_PR = struct
    open UnPr
+   fun map f p = p o f
    fun op andAlso (p, q) ? = p ? andalso q ?
    fun op orElse (p, q) ? = p ? orelse q ?
    fun negate p = not o p

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2006-12-20 21:05:44 UTC (rev 4993)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb	2006-12-21 21:21:56 UTC (rev 4994)
@@ -68,7 +68,11 @@
          basis Fix = bas public/generic/fix.sig detail/fix.sml end
          basis UnPr = bas public/fn/un-pr.sig detail/un-pr.sml end
          basis Order = bas public/data/order.sig detail/order.sml end
-         basis BinPr = bas public/fn/bin-pr.sig detail/bin-pr.sml end
+         basis BinPr = let
+            open Sq UnPr
+         in
+            bas public/fn/bin-pr.sig detail/bin-pr.sml end
+         end
          basis Cmp = let
             open Fn Order Sq
          in

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/bin-pr.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/bin-pr.sig	2006-12-20 21:05:44 UTC (rev 4993)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/bin-pr.sig	2006-12-21 21:21:56 UTC (rev 4994)
@@ -8,4 +8,7 @@
 signature BIN_PR = sig
    type 'a t = 'a Sq.t UnPr.t
    (** Type of binary predicates or relations (e.g. {<, <=, >=, >, ...}). *)
+
+   val map : ('a -> 'b) -> 'b t -> 'a t
+   (** Change the domain of a binary predicate. *)
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/un-pr.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/un-pr.sig	2006-12-20 21:05:44 UTC (rev 4993)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/fn/un-pr.sig	2006-12-21 21:21:56 UTC (rev 4994)
@@ -6,9 +6,12 @@
 
 (** Utilities for dealing with (unary) predicates. *)
 signature UN_PR = sig
-   type 'a t = 'a -> bool
+   type 'a t = 'a -> Bool.t
    (** Type of (unary) predicates (e.g. {null, isSome, ...}). *)
 
+   val map : ('a -> 'b) -> 'b t -> 'a t
+   (** Change the domain of a predicate. *)
+
    val andAlso : 'a t BinOp.t
    (** Conjunction of predicates ({(p andAlso q) x = p x andalso q y}). *)
 




More information about the MLton-commit mailing list