add label to ambiguous argument

This commit is contained in:
Rhiannon Morris 2020-12-06 10:37:01 +01:00
parent 9326f47ba2
commit a2030efaca
2 changed files with 5 additions and 5 deletions

8
seq.ml
View file

@ -50,13 +50,13 @@ let rec drop_while p seq =
| Cons (x, xs) -> | Cons (x, xs) ->
if p x then drop_while p xs else cons x xs if p x then drop_while p xs else cons x xs
let chunks p = let chunks ~sep =
unfold (fun seq -> unfold (fun seq ->
match break' p seq with match break' sep seq with
| Empty_seq -> None | Empty_seq -> None
| Span (lst, seq) -> Some (lst, drop_while p seq)) | Span (lst, seq) -> Some (lst, drop_while sep seq))
let line_chunks' = chunks (fun s -> s = "") let line_chunks' = chunks ~sep:(fun s -> s = "")
let line_chunks ?(join=" ") seq = map (String.concat join) (line_chunks' seq) let line_chunks ?(join=" ") seq = map (String.concat join) (line_chunks' seq)
let%test_module _ = (module struct let%test_module _ = (module struct

View file

@ -11,7 +11,7 @@ val break: ('a -> bool) -> 'a t -> 'a list * 'a t
val drop_while: ('a -> bool) -> 'a t -> 'a t val drop_while: ('a -> bool) -> 'a t -> 'a t
val chunks: ('a -> bool) -> 'a t -> 'a list t val chunks: sep:('a -> bool) -> 'a t -> 'a list t
val line_chunks': string t -> string list t val line_chunks': string t -> string list t
val line_chunks: ?join:string -> string t -> string t val line_chunks: ?join:string -> string t -> string t