Questions tagged [ocaml-lwt]

Use for questions regarding Lwt, an OCaml promise and concurrent programming library.

Lwt is 's concurrent programming library. It provides a single data type: the promise, which is a value that will become determined in the future. Creating a promise spawns a computation. When that computation is I/O, Lwt runs it in parallel with your OCaml code.

OCaml code, including creating and waiting on promises, is run in a single thread by default, so you don't have to worry about locking or preemption. You can detach code to be run in separate threads on an opt-in basis.

Useful resources

49 questions
0
votes
0 answers

Calling Lwt_process.pread_lines multiple times

I'm trying to use Lwt_process.pread_lines to get the output of a few commands. In my Lwt_main.run I call it once, and start processing each line of output separately though Lwt_stream.map, which works well. In that processing though, if I call…
Ulrar
  • 895
  • 8
  • 17
0
votes
2 answers

Lwt and recursive functions

Is it ok to use Lwt.return as the final call in a recursive function? I have a function that compiles fine but does not run properly and it looks like the function f below. Please assume that there is no issue with any function provided as g in this…
Thomas
  • 347
  • 3
  • 19
0
votes
1 answer

OCaml Unix Error

I have run into an error that I am not sure how to debug. The error is Exception: (Unix.Unix_error "Too many open files" pipe ""). I am not opening any files and only have a single Unix process open. Anybody have some tips on how to debug this? The…
Thomas
  • 347
  • 3
  • 19
0
votes
2 answers

Compiling program that uses Lwt_term

I have the following code in OCaml: open Lwt open Lwt_term let () = Lwt_main.run ( lwt l = Lwt_read_line.read_line ~prompt:[text "foo> "] ()) when I try to compile using ocamlfind ocamlc -package lwt cli.ml - o cli.byte it I get the following…
Sergi Mansilla
  • 12,495
  • 10
  • 39
  • 48
1 2 3
4