Skip to content

Instantly share code, notes, and snippets.

@NhanHo
Last active August 29, 2015 14:24
Show Gist options
  • Save NhanHo/56bcfc41151d49a0186a to your computer and use it in GitHub Desktop.
Save NhanHo/56bcfc41151d49a0186a to your computer and use it in GitHub Desktop.
let map f m_in =
let m_out = Lwt_mvar.create_empty () in
let rec aux () =
Lwt_mvar.(
take m_in >>=
f >>= fun v ->
put m_out v >>
aux ()
)
in
let t = aux () in
do_something(m_out);
m_out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment