Last active
August 29, 2015 14:24
-
-
Save NhanHo/56bcfc41151d49a0186a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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