let main () : unit Deferred.t =
(* First, we define the message we want to write and the name of the file we
* want to write to. *)
let msg = "hello world!" in
let file = "writeString.txt" in
(* Next, we open up a file with the filename we chose up above. If the file
* already existed, it's contents are erased. Writer.open_file returns,
* expectedly, a Writer.t. *)
Writer.open_file file >>= fun w ->
(* Once we have our hands on w, we call Writer.write_line just like we did
* when we wrote to stdout. *)
Writer.write_line w msg;
(* Finally, we close the file. We're required to close all the writers we
* open. *)
Writer.close w