user1252446
user1252446

Reputation:

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.

Upvotes: 4

Views: 1308

Answers (1)

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66818

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

Upvotes: 3

Related Questions