alifirat
alifirat

Reputation: 2937

Ocaml : How compile a file using the module Http_Client.Convenience?

I'm trying to compile a file using the module Http_Client.Convenience (his documentation is here : Http_Client.Convenience

I have the file foo.ml :

let result = Http_client.Convenience.http_put "Foo"

I'm compiling with this way :

ocamlfind ocamlopt  -o foo -linkpkg -package netclient foo.ml

According to this website Objective Caml, this line should be compile without the following error : "Unbound module Http_client".

What is wrong in my compilation directive ?

Upvotes: 1

Views: 220

Answers (1)

user1971598
user1971598

Reputation:

Here's what worked for me:

(* This is curried since http_put takes 2 string and we are only giving 1 
   val Nethttp_client.Convenience.http_put string -> string -> string  *)                     

let result = Nethttp_client.Convenience.http_put "Foo"


ocamlfind ocamlc foo.ml -package netclient -linkpkg -o Foo

You could also do

    (* This is foo.ml *)
    open Nethttp_client 
    let result = Convenience.http_put "Foo"

And then on the command line:

   ocamlfind ocamlc foo.ml -package netclient -linkpkg -o Foo

Upvotes: 2

Related Questions