[MLton-commit] r5527

Stephen Weeks sweeks at mlton.org
Sun Apr 15 20:25:53 PDT 2007


Added Option.for.

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

U   mltonlib/trunk/com/sweeks/basic/unstable/option.0.sml
U   mltonlib/trunk/com/sweeks/basic/unstable/option.sig

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

Modified: mltonlib/trunk/com/sweeks/basic/unstable/option.0.sml
===================================================================
--- mltonlib/trunk/com/sweeks/basic/unstable/option.0.sml	2007-04-14 21:44:04 UTC (rev 5526)
+++ mltonlib/trunk/com/sweeks/basic/unstable/option.0.sml	2007-04-16 03:25:52 UTC (rev 5527)
@@ -7,6 +7,11 @@
 
    datatype 'a t = None | Some of 'a
 
+   fun for (opt, f) =
+      case opt of
+         None => ()
+       | Some x => f x
+
    fun map (opt, f) =
       case opt of
          None => None

Modified: mltonlib/trunk/com/sweeks/basic/unstable/option.sig
===================================================================
--- mltonlib/trunk/com/sweeks/basic/unstable/option.sig	2007-04-14 21:44:04 UTC (rev 5526)
+++ mltonlib/trunk/com/sweeks/basic/unstable/option.sig	2007-04-16 03:25:52 UTC (rev 5527)
@@ -12,6 +12,7 @@
     * The standard option type (with correct capitalization).
     *)
 
+   val for: 'a t * ('a -> Unit.t) -> Unit.t
    val isNone: 'a t -> Bool.t
    (**
     * isNone None = true




More information about the MLton-commit mailing list