Re: To be or not to be - these are the options for Option.map
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the tips :)
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?
Jon