Re: How do I locate .mli files from OPAM modules?
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <CAMu2m2JCFd0xdjzA1ks56snTLXqxCgXkD9gTJzK_GyXE_T1hqA@mail.gmail.com> |
The Async library is split into smaller ones. If you looked strictly at the "async" repo, you indeed won't find much there. Check out the "async_kernel" repo, which is where the main functionality of Async is implemented. You can also find the mli files within your opam repo. The path you need can be determined by doing: opam config var async_kernel:lib However, note that this only works because Async's install scripts do copy their mli files. These aren't actually required and many packages don't do this. Finally, note the html docs are here: https://ocaml.janestreet.com/ocaml-core/ On Tue, Sep 2, 2014 at 3:25 PM, [email protected] [ocaml_beginners] < [email protected]> wrote: > > > I have some code that opens a module (Async) that I have installed through > OPAM. I would like to see the signature of this module, but where do I find > this? > > I have traversed the Async github repo but it was very unenlightening. How > do I approach this problem? > > This is the code I am looking at: > > (* This file is in the public domain *) > > (* open Core.Std *) > open Async.Std > (* open Cohttp_async *) > > (* given filename: hello_world.ml compile with: > $ corebuild hello_world.native -pkg cohttp.async > *) > > 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" > > let start_server port () = > eprintf "Listening for HTTP on port %d\n" port; > eprintf "Try 'curl http://localhost:%d/test?hello=xyz'\n%!" port; > Cohttp_async.Server.create ~on_handler_error:`Raise > (Tcp.on_port port) handler > >>= fun _ -> Deferred.never () > > let () = > Command.async_basic > ~summary:"Start a hello world Async server" > Command.Spec.(empty +> > flag "-p" (optional_with_default 8080 int) > ~doc:"int Source port to listen on" > ) start_server > > |> Command.run > > > >