简体   繁体   中英

OCaml Syntax: what does >>= mean?

in this piece of code:

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 ...

Although I can more or less guess what it does, I couldn't find any official definition on what " >>= " means and how it works.

The symbol >>= is defined by Lwt, not by OCaml itself. It's an infix operator equivalent to bind . You can see the definition here: Lwt module .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM