File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
33## main
4- - change the semantic of CCFloat.{min,max} with respect to NaN to follow the Stdlib
5- - change the semantic of CCInt.rem with respect to negative number to follow the Stdlib
4+ - breaking: invert the argument of CCFun.compose to align it with the Stdlib
5+ - breaking: change the semantic of CCFloat.{min,max} with respect to NaN to follow the Stdlib
6+ - breaking: change the semantic of CCInt.rem with respect to negative number to follow the Stdlib
67
78## 3.15
89
Original file line number Diff line number Diff line change @@ -10,7 +10,13 @@ include Fun
1010
1111let [@ inline] and_pred f g x = f x && g x
1212let [@ inline] or_pred f g x = f x || g x
13- let [@ inline] compose f g x = g (f x)
13+
14+ [@@@ iflt 5.2 ]
15+
16+ let [@ inline] compose f g x = f (g x)
17+
18+ [@@@ endif]
19+
1420let [@ inline] compose_binop f g x y = g (f x) (f y)
1521let [@ inline] curry f x y = f (x, y)
1622let [@ inline] uncurry f (x, y) = f x y
@@ -63,7 +69,7 @@ let rec iterate n f x =
6369
6470module Infix = struct
6571 (* default implem for some operators *)
66- let ( %> ) = compose
72+ let ( %> ) f g = compose g f
6773 let [@ inline] ( % ) f g x = f (g x)
6874 let ( let @ ) = ( @@ )
6975 let ( ||> ) (a , b ) f = f a b
Original file line number Diff line number Diff line change @@ -17,8 +17,11 @@ val or_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool
1717 @since 3.13.1
1818*)
1919
20- val compose : ('a -> 'b ) -> ('b -> 'c ) -> 'a -> 'c
21- (* * [compose f g x] is [g (f x)]. Composition. *)
20+ [@@@ iflt 5.2 ]
21+ val compose : ('b -> 'c ) -> ('a -> 'b ) -> 'a -> 'c
22+ (* * [compose f g x] is [f (g x)]. Composition.
23+ @since NEXT_RELEASE arguments are inversted *)
24+ [@@@ endif]
2225
2326val compose_binop : ('a -> 'b ) -> ('b -> 'b -> 'c ) -> 'a -> 'a -> 'c
2427(* * [compose_binop f g] is [fun x y -> g (f x) (f y)].
@@ -84,7 +87,8 @@ val iterate : int -> ('a -> 'a) -> 'a -> 'a
8487
8588module Infix : sig
8689 val ( %> ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
87- (* * [(f %> g) x] or [(%>) f g x] is [g (f x)]. Alias to [compose]. *)
90+ (* * [(f %> g) x] or [(%>) f g x] is [g (f x)]. Infix version of [compose].
91+ The order of the arguments of [%>] and {!compose} are inverted. *)
8892
8993 val ( % ) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
9094 (* * [(f % g) x] or [(%) f g x] is [f (g x)]. Mathematical composition. *)
You can’t perform that action at this time.
0 commit comments