File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
3
## 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
6
7
7
8
## 3.15
8
9
Original file line number Diff line number Diff line change @@ -10,7 +10,13 @@ include Fun
10
10
11
11
let [@ inline] and_pred f g x = f x && g x
12
12
let [@ 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
+
14
20
let [@ inline] compose_binop f g x y = g (f x) (f y)
15
21
let [@ inline] curry f x y = f (x, y)
16
22
let [@ inline] uncurry f (x, y) = f x y
@@ -63,7 +69,7 @@ let rec iterate n f x =
63
69
64
70
module Infix = struct
65
71
(* default implem for some operators *)
66
- let ( %> ) = compose
72
+ let ( %> ) f g = compose g f
67
73
let [@ inline] ( % ) f g x = f (g x)
68
74
let ( let @ ) = ( @@ )
69
75
let ( ||> ) (a , b ) f = f a b
Original file line number Diff line number Diff line change @@ -17,8 +17,13 @@ val or_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool
17
17
@since 3.13.1
18
18
*)
19
19
20
- val compose : ('a -> 'b ) -> ('b -> 'c ) -> 'a -> 'c
21
- (* * [compose f g x] is [g (f x)]. Composition. *)
20
+ [@@@ iflt 5.2 ]
21
+
22
+ val compose : ('b -> 'c ) -> ('a -> 'b ) -> 'a -> 'c
23
+ (* * [compose f g x] is [f (g x)]. Composition.
24
+ @since NEXT_RELEASE arguments are inversted *)
25
+
26
+ [@@@ endif]
22
27
23
28
val compose_binop : ('a -> 'b ) -> ('b -> 'b -> 'c ) -> 'a -> 'a -> 'c
24
29
(* * [compose_binop f g] is [fun x y -> g (f x) (f y)].
@@ -84,7 +89,8 @@ val iterate : int -> ('a -> 'a) -> 'a -> 'a
84
89
85
90
module Infix : sig
86
91
val ( %> ) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
87
- (* * [(f %> g) x] or [(%>) f g x] is [g (f x)]. Alias to [compose]. *)
92
+ (* * [(f %> g) x] or [(%>) f g x] is [g (f x)]. Infix version of [compose].
93
+ The order of the arguments of [%>] and {!compose} are inverted. *)
88
94
89
95
val ( % ) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c
90
96
(* * [(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