diff --git a/src/core/CCList.ml b/src/core/CCList.ml index 70ab4f5b..f3e2a707 100644 --- a/src/core/CCList.ml +++ b/src/core/CCList.ml @@ -474,7 +474,7 @@ let count_true_false p l = count_true_false (fun x -> x mod 2 = 0) [2; 6; 9; 4] = (3, 1) *) -let product f l1 l2 = +let[@inline] product f l1 l2 = flat_map (fun x -> map (fun y -> f x y) l2) l1 let fold_product f acc l1 l2 = @@ -1789,8 +1789,8 @@ let of_klist l = direct direct_depth_default_ l module Infix = struct - let (>|=) l f = map f l - let (>>=) l f = flat_map f l + let[@inline] (>|=) l f = map f l + let[@inline] (>>=) l f = flat_map f l let (@) = (@) let (<*>) = (<*>) let (<$>) = map @@ -1799,9 +1799,9 @@ module Infix = struct include CCShimsMkLet_.Make(struct type 'a t = 'a list - let (>|=) = (>|=) - let (>>=) = (>>=) - let monoid_product l1 l2 = product (fun x y -> x,y) l1 l2 + let (>|=) = (>|=) + let (>>=) = (>>=) + let[@inline] monoid_product l1 l2 = product (fun x y -> x,y) l1 l2 end) end diff --git a/src/core/CCOpt.ml b/src/core/CCOpt.ml index 18a6607b..706049d5 100644 --- a/src/core/CCOpt.ml +++ b/src/core/CCOpt.ml @@ -4,7 +4,7 @@ type 'a t = 'a option -let map f = function +let[@inline] map f = function | None -> None | Some x -> Some (f x) @@ -38,11 +38,11 @@ let equal f o1 o2 = match o1, o2 with let return x = Some x -let flat_map f o = match o with +let[@inline] flat_map f o = match o with | None -> None | Some x -> f x -let bind o f = flat_map f o +let[@inline] bind o f = flat_map f o let (>>=) = bind @@ -169,7 +169,7 @@ module Infix = struct type 'a t = 'a option let (>|=) = (>|=) let (>>=) = (>>=) - let monoid_product o1 o2 = match o1, o2 with + let[@inline] monoid_product o1 o2 = match o1, o2 with | Some x, Some y -> Some (x,y) | _ -> None end)