Commits

camlspotter  committed 1cd6acc

added Monad.void, equal to Monad.ignore

  • Participants
  • Parent commits e4bf967

Comments (0)

Files changed (2)

   end
 
   let ignore a = a >>= fun _ -> return ()
+  let void = ignore
 
   let rec seq = function
     | [] -> return []
   end
 
   let ignore a = a >>= fun _ -> return ()
+  let void = ignore
 
   let rec seq = function
     | [] -> return []

File monad_intf.ml

   module Open : Open with type 'a t = 'a t
 
   val map : f:('a -> 'b) -> 'a t -> 'b t
-    (** fmap in Haskell *)
-  val ignore : 'a t -> unit t
+  (** fmap in Haskell *)
+
+  val ignore : 'a t -> unit t (* CR jfuruse: ignore is confusing with Pervasives.ignore. Probably it should be superceded by void *)
+  val void : 'a t -> unit t
+
   val seq : 'a t list -> 'a list t
     (** sequence in Haskell. Not tail recursive. *)
   val seq_ : unit t list -> unit t
 
   val map : f:('a -> 'b) -> ('a, 'z) t -> ('b, 'z) t
     (** fmap in Haskell *)
-  val ignore : ('a, 'z) t -> (unit, 'z) t
+
+  val ignore : ('a, 'z) t -> (unit, 'z) t  (* CR jfuruse: ignore is confusing with Pervasives.ignore. Probably it should be superceded by void *)
+  val void : ('a, 'z) t -> (unit, 'z) t
+
   val seq : ('a, 'z) t list -> ('a list, 'z) t
     (** sequence in Haskell. Not tail recursive. *)
   val seq_unit : (unit, 'z) t list -> (unit, 'z) t