mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
Gave up on CCFun
Gave up on k_compose for CCFun. Unclear with how to translate function signature into CPS.
This commit is contained in:
parent
01155686bf
commit
3c70b921cb
2 changed files with 1 additions and 13 deletions
|
|
@ -77,11 +77,7 @@ struct
|
|||
type 'a t = X.t -> 'a
|
||||
|
||||
let[@inline] return x _ = x
|
||||
let[@inline] k_compose f g =
|
||||
(fun x -> f x |> flat_map g)
|
||||
let[@inline] ( >|= ) f g x = g (f x)
|
||||
let[@inline] ( >>= ) f g x = g (f x) x
|
||||
let[@inline] ( >=> ) = k_compose
|
||||
let[@inline] ( <=< ) = flip k_compose
|
||||
end
|
||||
[@@inline]
|
||||
|
|
|
|||
|
|
@ -101,22 +101,14 @@ module Monad (X : sig
|
|||
type t
|
||||
end) : sig
|
||||
type 'a t = X.t -> 'a
|
||||
(** Definition of a monad in continuation-passing style. *)
|
||||
|
||||
val return : 'a -> 'a t
|
||||
(** Monadic [return]. *)
|
||||
|
||||
val k_compose : ('a -> 'b t) -> ('b -> 'c t) -> ('a -> 'c t)
|
||||
(** Kleisli composition. Monadic equivalent of [compose]. *)
|
||||
|
||||
val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t
|
||||
(** Monadic [map]. *)
|
||||
|
||||
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
|
||||
(** Monadic [bind]. *)
|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue