This commit is contained in:
Simon Cruanes 2024-07-19 14:04:00 -04:00
parent e933995733
commit cb14c0d04b
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
4 changed files with 5 additions and 10 deletions

View file

@ -54,10 +54,9 @@ let[@inline] flat_map_l f o =
let[@inline] bind o f = flat_map f o
let ( >>= ) = bind
let pure x = Some x
let k_compose f g x = f x |> flat_map g
let ( >=> ) = k_compose
let ( <=< ) f g = g >=> f
let ( <=< ) f g = g >=> f
let ( <*> ) f x =
match f, x with
@ -202,9 +201,7 @@ module Infix = struct
| _ -> None
let ( and* ) = ( and+ )
let ( >=> ) = ( >=> )
let ( <=< ) = ( <=< )
end

View file

@ -194,7 +194,7 @@ module Infix : sig
val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
(** Monadic [k_compose]. *)
val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> 'a -> 'c t
(** Reverse monadic [k_compose]. *)
end

View file

@ -133,9 +133,8 @@ let flat_map f e =
| Error s -> Error s
let k_compose f g x = f x |> flat_map g
let ( >=> ) = k_compose
let ( <=< ) f g = g >=> f
let ( <=< ) f g = g >=> f
let equal ~err eq a b =
match a, b with
@ -288,7 +287,6 @@ module Infix = struct
| _, Error e -> Error e
let ( and* ) = ( and+ )
let ( >=> ) = ( >=> )
let ( <=< ) = ( <=< )
end

View file

@ -120,7 +120,7 @@ val catch : ('a, 'err) t -> ok:('a -> 'b) -> err:('err -> 'b) -> 'b
val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
val k_compose :
val k_compose :
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
(** Kleisli composition. Monadic equivalent of CCFun.compose *)
@ -216,7 +216,7 @@ module Infix : sig
val ( >=> ) :
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
(** Monadic [k_compose]. *)
val ( <=< ) :
('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t
(** Reverse monadic [k_compose]. *)