Ocaml:如何使用模块Http_Client.Convenience编译文件?

时间:2015-03-03 15:46:22

标签: http ocaml

我尝试使用模块Http_Client.Convenience编译文件(他的文档在这里:Http_Client.Convenience

我有foo.ml文件:

let result = Http_client.Convenience.http_put "Foo"

我用这种方式编译:

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

根据这个网站Objective Caml,这行应该编译而不会出现以下错误:" Unbound module Http_client"。

我的编译指令有什么问题?

1 个答案:

答案 0 :(得分:2)

这对我有用:

(* 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

您也可以

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

然后在命令行上:

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