[MLton-commit] r5351
geoffw at mlton.org
geoffw at mlton.org
Tue Feb 27 06:25:25 PST 2007
Extended Option with the collate function.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/option.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/option.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/option.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/option.sml 2007-02-27 13:16:50 UTC (rev 5350)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/option.sml 2007-02-27 14:13:59 UTC (rev 5351)
@@ -8,4 +8,10 @@
open Option
val isNone = fn NONE => true
| SOME _ => false
+
+ fun collate cmp = fn (NONE, NONE) => EQUAL
+ | (SOME _, NONE) => GREATER
+ | (NONE, SOME _) => LESS
+ | (SOME x1, SOME x2) => cmp (x1, x2)
+
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/option.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/option.sig 2007-02-27 13:16:50 UTC (rev 5350)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/option.sig 2007-02-27 14:13:59 UTC (rev 5351)
@@ -13,4 +13,11 @@
val isNone : 'a t UnPr.t
(** Returns {true} if given option is {NONE}; otherwise returns {false}. *)
+
+ val collate : 'a Cmp.t -> 'a t Cmp.t
+ (**
+ * Returns {EQUAL} if given {(NONE,NONE)}; {GREATER} if given
+ * {(SOME _, NONE)}; {LESS} if given {(NONE, SOME _)}; for
+ * {(SOME _, SOME _)} it uses the provided comparison function. *)
+
end
More information about the MLton-commit
mailing list