OCaml 语法:>>= 是什么意思?

OCaml Syntax: what does >>= mean?

在这段代码中:

let rec write_from_exactly out s offs len =
    Lwt_unix.write out s offs len >>= fun n ->
       if   n = len then Lwt.return ()
       else write_from_exactly out s (offs + n) (len - n)
in ...

虽然我或多或少能猜到它的作用,但我找不到关于“>>=”的含义及其工作原理的任何官方定义。

符号>>=是由Lwt定义的,不是OCaml本身定义的。它是等同于 bind 的中缀运算符。您可以在此处查看定义:Lwt module.