如何修改这行OCaml以不返回函数?
我试图克服这个错误,在不理解OCaml的情况下运行命令行实用程序如何修改这行OCaml以不返回函数?,ocaml,Ocaml,我试图克服这个错误,在不理解OCaml的情况下运行命令行实用程序 $ dune build File "_none_", line 1: Warning 58: no cmx file was found in path for module Toploop, and its interface was not compiled with -opaque File "vendor/notty/lwt/notty_lwt.ml", line 68, characters 25-64: Error:
$ dune build
File "_none_", line 1:
Warning 58: no cmx file was found in path for module Toploop, and its interface was not compiled with -opaque
File "vendor/notty/lwt/notty_lwt.ml", line 68, characters 25-64:
Error: This expression has type (unit -> unit) Lwt.t
but an expression was expected of type unit Lwt.t
Hint: Did you forget to provide `()' as argument?
第68行是这样的:
Lwt.async (fun () -> Lwt_stream.closed stream >|= fun _ -> f);
这是周围的环境,如果有帮助的话:
let input_stream ~nosig fd stop =
let `Revert f = setup_tcattr ~nosig (Lwt_unix.unix_file_descr fd) in
let stream =
let flt = Unescape.create ()
and ibuf = Bytes.create bsize in
let rec next () =
match Unescape.next flt with
| #Unescape.event as r -> Lwt.return_some r
| `End -> Lwt.return_none
| `Await ->
(Lwt_unix.read fd ibuf 0 bsize <??> stop) >>= function
| Left n -> Unescape.input flt ibuf 0 n; next ()
| Right _ -> Lwt.return_none
in Lwt_stream.from next in
Lwt.async (fun () -> Lwt_stream.closed stream >|= fun _ -> f);
stream
与
那么,我如何用我的68号线进行模拟呢
如果有必要,我会去学习一些OCaml和这个奇怪的语法,让我想起lambdas。但我所要做的就是安装一个基于终端的游戏计时器,这样我就可以玩我的游戏了,我已经在这个兔子洞里走得更远了,我不想再玩这个游戏了。任何帮助都将不胜感激。这句话真晦涩。到目前为止,我发现
|=
是映射的中缀符号。所以,也许这句话是。。。接受匿名函数并包装它们?尝试了几件事,但没有成功。这句话太晦涩了。到目前为止,我发现|=
是映射的中缀符号。所以,也许这句话是。。。接受匿名函数并包装它们?尝试了一些东西但没有成功。我想我是随机尝试的。我一定是在其他地方有剩余的变化,导致了不同的错误。它起作用了,谢谢。我想我是随机尝试的。我一定是在其他地方有剩余的变化,导致了不同的错误。成功了,谢谢你。
Lwt.async (fun () -> Lwt_stream.closed stream >|= fun _ -> f ());
let create_server sock =
Lwt_unix.accept sock >>= accept_connection
Lwt.async (fun () -> Lwt_stream.closed stream >|= fun _ -> f ());