ocamllwt

OCaml lwt utop infix bind operator >>= is missing


I call require "lwt.simple-top" ;; on utop and try a simple example but it is not able to find the operator >>=.

enter image description here


Solution

  • The #require is a toplevel directive, that link the library code into the toplevel. It doesn't open any modules. So in order to get the infix operators >>= and >|=, you need to open Lwt.Infix or Lwt modules, the latter will also bring all definitions from Lwt module, that may be considered as a namespac pollution.