Skip to content

Commit 7825f9a

Browse files
committed
Adding Util.min to the Util module
`Int.min` was introduced in OCaml 4.13 Signed-off-by: Paul-Elliot <[email protected]>
1 parent 907eb65 commit 7825f9a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/block.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ let lstrip strings =
162162
let hpad = Misc.hpad_of_lines strings in
163163
List.map
164164
(fun string ->
165-
let min a b = if a < b then a else b in
166-
let first = min (Misc.hpad_of_lines [ string ]) hpad in
165+
let first = Util.Int.min (Misc.hpad_of_lines [ string ]) hpad in
167166
Astring.String.with_index_range string ~first)
168167
strings
169168

lib/util.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,7 @@ module Process = struct
116116
let wait ~pid =
117117
match snd (Unix.waitpid [] pid) with WEXITED n -> n | _ -> 255
118118
end
119+
120+
module Int = struct
121+
let min a b = if a < b then a else b
122+
end

lib/util.mli

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ module Process : sig
7777
Exit code is the same as the child process if it exits normally, or 255
7878
otherwise. *)
7979
end
80+
81+
module Int : sig
82+
val min : int -> int -> int
83+
end

0 commit comments

Comments
 (0)