Ocaml:如何使用模块 Http_Client.Convenience 编译文件?
Ocaml : How compile a file using the module Http_Client.Convenience?
我正在尝试使用模块 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".
我的编译指令有什么问题?
以下是对我有用的方法:
(* 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
我正在尝试使用模块 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".
我的编译指令有什么问题?
以下是对我有用的方法:
(* 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