Commits

camlspotter  committed 576ad4e

merge

  • Participants
  • Parent commits 4a314c0

Comments (0)

Files changed (2)

File lib/monad.ml

   include M
 
   let fmap f t = bind t (fun x -> return (f x))
-  let liftM f t = bind t (fun x -> return (f x))
-  let liftM2 f t1 t2 = bind t1 (fun v1 -> bind t2 (fun v2 -> return (f v1 v2)))
+  let liftM = fmap
   let map ~f t = fmap f t
-  let liftM = fmap
 
-  let fmap2 f t1 t2 = 
-    bind t1 (fun a1 ->
-      bind t2 (fun a2 ->
-        return (f a1 a2)))
+  let fmap2 f t1 t2 = bind t1 (fun v1 -> bind t2 (fun v2 -> return (f v1 v2)))
   let liftM2 = fmap2
 
   module Open_ = struct

File lib/monad_intf.ml

   (** for [M : T], [open M.Open] may provide some common functions of [M] in the name space. *)
 
   val fmap : ('a -> 'b) -> 'a t -> 'b t
+  val liftM : ('a -> 'b) -> 'a t -> 'b t
+  val map : f:('a -> 'b) -> 'a t -> 'b t
   (** fmap in Haskell *)
 
-  val liftM : ('a -> 'b) -> 'a t -> 'b t
+  val fmap2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
   val liftM2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
 
-  val map : f:('a -> 'b) -> 'a t -> 'b t
-  (** fmap in Haskell *)
-  val liftM : ('a -> 'b) -> 'a t -> 'b t
-    
-  val fmap2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
-  val liftM2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
 
   val void : 'a t -> unit t