mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-08 12:15:32 -05:00
perf: a few more inline annotations
This commit is contained in:
parent
97e49b6a5c
commit
18222af1a3
2 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue