To be or not to be - these are the options for Option.map

"[email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Ashish Agarwal showed me how to neatly find source files for OPAM packages. This allowed me to locate the .mli file for Core.Std.Option.map:
 

 ~/.opam/system/lib/core_kernel/option.mli
 

 Using this command:
 

 opam config var core_kernel:lib


 -----------------
 

 I have this code that uses Core.Std.Option.map:
 

 let handler ~body:_ _sock req =
  let uri = Cohttp.Request.uri req in
  match Uri.path uri with 
  | "/test" ->
       Uri.get_query_param uri "hello"
    |> Core.Std.Option.map ~f:(fun v -> "hello: " ^ v)
    |> Core.Std.Option.value ~default:"No param hello supplied"
    |> Cohttp_async.Server.respond_with_string
  | _ ->
    Cohttp_async.Server.respond_with_string ~code:`Not_found "Route not found"
 

 However, looking in ~/.opam/system/lib/core_kernel/option.mli reveals no definition of the map function. The closest match is "val map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t".
 

 How can the code compile just fine when the 'map' definition isn't there?
 

 This is the content of  ~/.opam/system/lib/core_kernel/option.mli:
 https://github.com/janestreet/core_kernel/blob/master/lib/option.mli https://github.com/janestreet/core_kernel/blob/master/lib/option.mli
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.