Advertisement
Guest User

Untitled

a guest
Dec 19th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.66 KB | None | 0 0
  1.                 (* this does not work as I expected*)
  2.                 (* this gives a warning, Lwt.return line warning: Warning 10: this expression should have type unit. *)
  3.                 readall fd >>= fun a ->
  4.                    ignore(Lwt_io.printf "readall result\n%!");
  5.                    ignore(Lwt_io.printf "%s\n%!" a);
  6.                    Lwt.return(Lwt_unix.close fd ) ;
  7.  
  8.  
  9.                 (* this works as expected *)
  10.                 Lwt.bind (readall fd)
  11.                    (fun a ->
  12.                    ignore(Lwt_io.printf "readall result\n%!");
  13.                    ignore(Lwt_io.printf "%s\n%!" a);
  14.                    Lwt.return(Lwt_unix.close fd );) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement