Commits

camlspotter committed c6a8e7e

added (//)

Comments (0)

Files changed (2)

            but it is not possible...
         *)
 
-  let from_option = default
-  let (//) = default
+  let (//) t v = match t with
+    | None -> v
+    | Some v -> v
 end
 
 include Pervasives
     dynamically.
 *)
 
-val from_option : 'a t -> (unit -> 'a) -> 'a
-(** synonym of [default] *)
-
-val (//) : 'a t -> (unit -> 'a) -> 'a
-(** synonym of [default] *)
+val (//) : 'a t -> 'a -> 'a
+(** Same as [default] but the default value is always evaluated *)
 
 val (>>=!) : 'a t -> (unit -> 'a t) -> 'a t  
 (** bindE. *)
   val from_Some : 'a option -> 'a
   (** may raise [Invalid_argument] *)
 
-  val from_option : 'a t -> (unit -> 'a) -> 'a
-  (** Synonym of [default]. Core's [Option.value]. Batterie's [(|?)] *)
-
-  val (//) : 'a t -> (unit -> 'a) -> 'a
-  (** Synonym of [default], inspired from Perl's (//). 
-      Core's [Option.value]. Batteries' [(|?)] *)
+  val (//) : 'a t -> 'a -> 'a
+  (** Same as [default] but the default value is always evaluated *)
 end