Skip to content

Commit

Permalink
cohttp-eio(header): change mapper to object type
Browse files Browse the repository at this point in the history
  • Loading branch information
bikallem committed Jan 18, 2023
1 parent 73da9b8 commit 94548d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cohttp-eio/src/header.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ let make_header_t : #header_definition -> 'a header_t =

type v = V : 'a header * 'a Lazy.t -> v (* Header values are stored lazily. *)
type binding = B : 'a header * 'a -> binding
type mapper = { f : 'a. 'a header -> 'a -> 'a }
type mapper = < f : 'a. 'a header -> 'a -> 'a >

module M = Map.Make (String)

Expand Down Expand Up @@ -265,13 +265,13 @@ let find_opt k t =
let iter f t =
M.iter (fun _key v -> match v with V (k, v) -> f @@ B (k, Lazy.force v)) t.m

let map mapper t =
let map (m : mapper) t =
let m =
M.map
(fun v ->
match v with
| V (k, v) ->
let v = mapper.f k @@ Lazy.force v in
let v = m#f k @@ Lazy.force v in
V (k, lazy v))
t.m
in
Expand Down

0 comments on commit 94548d9

Please sign in to comment.