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

"Jeremy Yallop [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAAxsn=GJkz7i5oAz3z7nqzS1WgJy834RGHByLAi_x4DfY2DWrg@mail.gmail.com>
On 6 September 2014 22:14, [email protected] [ocaml_beginners]
<[email protected]> wrote:
> I still find myself struggling to follow the references that lies behind module names. Take for instance the name 'Uri' in line 3 in this code:
>
> let handler ~body:_ _sock req =
>   let uri = Cohttp.Request.uri req in  (* a *)
>   match Uri.path uri with              (* b *)
>   | "/test" ->
>        Uri.get_query_param uri "hello"
>     |> Core.Std.Option.map ~f:(fun v -> "hello: " ^ v)            (* c *)
>     |> 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"
>
> How am I supposed to go about figuring out what 'Uri' refers to?
> I have resorted to download all jane street repositories that has the words 'core' and 'async' as part of their names and then grepping for the module names that I am looking for. However, this produces hundreds of hits.
> How do experienced Ocaml go about tracking these references?
> Could there be automated plugins for, say, Emacs?

I think that merlin makes it possible to jump to the definition from
within Emacs:

   https://opam.ocaml.org/blog/turn-your-editor-into-an-ocaml-ide/
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.