-
-
Save pirapira/1318201 to your computer and use it in GitHub Desktop.
Async reading memo
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
| async_core.mli: | |
| deferred.mli: value to be determined later (that forms monad) / enable choose mechanism | |
| clock.mli: defer until certain times | |
| typed_tcp.mli: would be fun to use | |
| writer.mli: reducing number of write() calls | |
| #use "topfind";; | |
| #thread;; | |
| #require "core";; | |
| #require "async";; | |
| open Async.Pipe;; |
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
| $ ocaml | |
| Objective Caml version 3.12.0 | |
| # #use "topfind";; | |
| - : unit = () | |
| Findlib has been successfully loaded. Additional directives: | |
| #require "package";; to load a package | |
| #list;; to list the available packages | |
| #camlp4o;; to load camlp4 (standard syntax) | |
| #camlp4r;; to load camlp4 (revised syntax) | |
| #predicates "p,q,...";; to set these predicates | |
| Topfind.reset();; to force that packages will be reloaded | |
| #thread;; to enable threads | |
| - : unit = () | |
| # #thread;; | |
| /usr/lib/ocaml/threads: added to search path | |
| /usr/lib/ocaml/unix.cma: loaded | |
| /usr/lib/ocaml/threads/threads.cma: loaded | |
| # #require "core";; | |
| /usr/lib/ocaml/dynlink.cma: loaded | |
| /usr/lib/ocaml/camlp4: added to search path | |
| /usr/local/lib/ocaml/3.12.0/type-conv: added to search path | |
| /usr/lib/ocaml/bigarray.cma: loaded | |
| /usr/lib/ocaml/nums.cma: loaded | |
| /usr/lib/ocaml/num-top: added to search path | |
| /usr/lib/ocaml/num-top/num_top.cma: loaded | |
| /usr/local/lib/ocaml/3.12.0/sexplib: added to search path | |
| /usr/local/lib/ocaml/3.12.0/sexplib/sexplib.cma: loaded | |
| /usr/local/lib/ocaml/3.12.0/fieldslib: added to search path | |
| /usr/local/lib/ocaml/3.12.0/fieldslib/fieldslib.cma: loaded | |
| /usr/local/lib/ocaml/3.12.0/bin_prot: added to search path | |
| /usr/local/lib/ocaml/3.12.0/bin_prot/bin_prot.cma: loaded | |
| /usr/lib/ocaml/res: added to search path | |
| /usr/lib/ocaml/res/res.cma: loaded | |
| /usr/local/lib/ocaml/3.12.0/core: added to search path | |
| /usr/local/lib/ocaml/3.12.0/core/core.cma: loaded | |
| # #require "async";; | |
| /usr/local/lib/ocaml/3.12.0/async: added to search path | |
| /usr/local/lib/ocaml/3.12.0/async/async.cma: loaded | |
| # open Async.Pipe;; | |
| # create;; | |
| - : ?slack:int -> | |
| ?slack_f:('a -> int) -> | |
| unit -> 'a Async.Pipe.Reader.t * 'a Async.Pipe.Writer.t | |
| = <fun> | |
| # let (r,w) = create ();; | |
| val r : '_a Async.Pipe.Reader.t = <abstr> | |
| val w : '_a Async.Pipe.Writer.t = <abstr> | |
| # let writing = write w "go in and come out";; | |
| val writing : unit Async.Deferred.t = <abstr> | |
| # let reading = read r;; | |
| val reading : [ `Eof | `Ok of string ] Async.Deferred.t = <abstr> | |
| # open Async.Deferred;; | |
| # peek reading;; | |
| - : [ `Eof | `Ok of string ] option = Some (`Ok "go in and come out") | |
| # let writing2 = write w "second write;";; | |
| val writing2 : unit Async.Deferred.t = <abstr> | |
| # peek reading;; | |
| - : [ `Eof | `Ok of string ] option = Some (`Ok "go in and come out") | |
| # let reading2 = read r;; | |
| val reading2 : [ `Eof | `Ok of string ] Async.Deferred.t = <abstr> | |
| # peek reading2;; | |
| - : [ `Eof | `Ok of string ] option = Some (`Ok "second write;") | |
| # let reading3 = read r;; | |
| val reading3 : [ `Eof | `Ok of string ] Async.Deferred.t = <abstr> | |
| # peek reading3;; | |
| - : [ `Eof | `Ok of string ] option = None | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment