Revert "CCFun(cleanup): align CCFun.compose with the stdlib"

This reverts commit b649ac9dc5.
This commit is contained in:
Emmanuel Arrighi 2026-02-06 19:10:34 +01:00
parent b8f1048ce4
commit 8f30ce25b6
3 changed files with 5 additions and 18 deletions

View file

@ -2,7 +2,6 @@
## main ## main
- breaking: CCListLabel.compare and CCListLabel.equal takes the function on the elements as named arguments - breaking: CCListLabel.compare and CCListLabel.equal takes the function on the elements as named arguments
- breaking: CCListLabel.init now takes the length as a named arguments to follow the Stdlib - breaking: CCListLabel.init now takes the length as a named arguments to follow the Stdlib
- breaking: invert the argument of CCFun.compose to align it with the Stdlib
- breaking: change the semantic of CCFloat.{min,max} with respect to NaN to follow the Stdlib - breaking: change the semantic of CCFloat.{min,max} with respect to NaN to follow the Stdlib
- breaking: change the semantic of CCInt.rem with respect to negative number to follow the Stdlib - breaking: change the semantic of CCInt.rem with respect to negative number to follow the Stdlib
- breaking: change the order of argument of CCMap.add_seq to align with the stdlib. - breaking: change the order of argument of CCMap.add_seq to align with the stdlib.

View file

@ -10,13 +10,7 @@ include Fun
let[@inline] and_pred f g x = f x && g x let[@inline] and_pred f g x = f x && g x
let[@inline] or_pred f g x = f x || g x let[@inline] or_pred f g x = f x || g x
let[@inline] compose f g x = g (f x)
[@@@iflt 5.2]
let[@inline] compose f g x = f (g x)
[@@@endif]
let[@inline] compose_binop f g x y = g (f x) (f y) let[@inline] compose_binop f g x y = g (f x) (f y)
let[@inline] curry f x y = f (x, y) let[@inline] curry f x y = f (x, y)
let[@inline] uncurry f (x, y) = f x y let[@inline] uncurry f (x, y) = f x y
@ -76,7 +70,7 @@ let[@inline] with_return (type ret) f : ret =
module Infix = struct module Infix = struct
(* default implem for some operators *) (* default implem for some operators *)
let ( %> ) f g = compose g f let ( %> ) = compose
let[@inline] ( % ) f g x = f (g x) let[@inline] ( % ) f g x = f (g x)
let ( let@ ) = ( @@ ) let ( let@ ) = ( @@ )
let ( ||> ) (a, b) f = f a b let ( ||> ) (a, b) f = f a b

View file

@ -17,13 +17,8 @@ val or_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool
@since 3.13.1 @since 3.13.1
*) *)
[@@@iflt 5.2] val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
(** [compose f g x] is [g (f x)]. Composition. *)
val compose : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
(** [compose f g x] is [f (g x)]. Composition.
@since NEXT_RELEASE arguments are inversted *)
[@@@endif]
val compose_binop : ('a -> 'b) -> ('b -> 'b -> 'c) -> 'a -> 'a -> 'c val compose_binop : ('a -> 'b) -> ('b -> 'b -> 'c) -> 'a -> 'a -> 'c
(** [compose_binop f g] is [fun x y -> g (f x) (f y)]. (** [compose_binop f g] is [fun x y -> g (f x) (f y)].
@ -105,8 +100,7 @@ let find_array arr x =
module Infix : sig module Infix : sig
val ( %> ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c val ( %> ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
(** [(f %> g) x] or [(%>) f g x] is [g (f x)]. Infix version of [compose]. (** [(f %> g) x] or [(%>) f g x] is [g (f x)]. Alias to [compose]. *)
The order of the arguments of [%>] and {!compose} are inverted. *)
val ( % ) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c val ( % ) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
(** [(f % g) x] or [(%) f g x] is [f (g x)]. Mathematical composition. *) (** [(f % g) x] or [(%) f g x] is [f (g x)]. Mathematical composition. *)