How to compile the examples in ocaml-core/base/async/examples ?

243 views
Skip to first unread message

Francois

unread,
Nov 7, 2012, 9:39:42 PM11/7/12
to ocaml...@googlegroups.com
Hello,

I'd like to compile then run some of them,
then have a look at their build scripts.

I don't know where never_returns is defined.

I also don't know with what lib I should link in
order to access the module Jane.Std.

Thanks,
F.

Malcolm Matalka

unread,
Nov 8, 2012, 1:13:36 AM11/8/12
to ocaml...@googlegroups.com
never_returns is in Core.Std. I'm might be wrong by I don't think
Jane.Std actually exists anymore, instead you want Core.Std and
Async.Std opened to have the equivalent effect.

Yaron Minsky

unread,
Nov 8, 2012, 6:41:04 AM11/8/12
to ocaml...@googlegroups.com
Jane.Std is some internal stuff that is not exported. We should fix
that example not to use it. Which specific example is it?

y

Stephen Weeks

unread,
Nov 8, 2012, 12:02:45 PM11/8/12
to ocaml...@googlegroups.com
> Jane.Std is some internal stuff that is not exported. We should fix
> that example not to use it. Which specific example is it?

Many of the examples in base/async/examples unnecessarily refer to
Jane.Std. I pushed a fix internally to change them all to Core.Std.

Francois Berenger

unread,
Nov 8, 2012, 8:00:59 PM11/8/12
to ocaml...@googlegroups.com
$ cd ~/.opam/system/build/async.108.07.01/examples
$ grep -ri jane.std *
bin_prot_test.ml:open Jane.Std
cat.ml:open Jane.Std
countdown.ml:open Jane.Std
finalizer.ml:open Jane.Std
monitors.ml:open Jane.Std
process.ml:open Jane.Std
process_stream.ml:open Jane.Std
server.ml:open Jane.Std
signals.ml:open Jane.Std
sigpipe.ml:open Jane.Std
socket.ml:open Jane.Std
sound.ml:open Jane.Std
write_forever.ml:open Jane.Std

Francois Berenger

unread,
Nov 8, 2012, 8:01:48 PM11/8/12
to ocaml...@googlegroups.com
By the way, how do I compile them?
It was my initial question. ;)

Stephen Weeks

unread,
Nov 8, 2012, 8:49:13 PM11/8/12
to ocaml...@googlegroups.com
I think replacing "Jane.Std" with "Core.Std" will work.

Dominick LoBraico

unread,
Nov 12, 2012, 3:20:43 PM11/12/12
to ocaml...@googlegroups.com
Francois,

If you have ocamlfind install, this should work (for example):

$ ocamlfind ocamlc -thread -package async -linkpkg hello.ml -o hello.exe

Francois Berenger

unread,
Nov 12, 2012, 8:02:50 PM11/12/12
to ocaml...@googlegroups.com
Thanks for the command.

In fact, it would be quite useful to have example programs for core too.
I think I saw just one, while async has many.

Dominick LoBraico

unread,
Nov 12, 2012, 10:29:23 PM11/12/12
to ocaml...@googlegroups.com
The fact that has probably blocked that is the general vastness of Core. There is an example file for the Command module included with Core I believe (command-line parsing module). If there are specific areas that you would like to see some clarity on I could write up some simple examples for you/the community.

Dominick LoBraico

unread,
Nov 12, 2012, 10:43:49 PM11/12/12
to ocaml...@googlegroups.com
As a follow-up, if you poke around in the various support libraries you'll find readme files which contain some small usage examples that may be of interest to you (e.g. ~/.opam/4.00.1+short-types/build/sexplib.108.07.01/README.md).

Malcolm Matalka

unread,
Nov 12, 2012, 11:59:47 PM11/12/12
to ocaml...@googlegroups.com
I don't know if it's still available, but the ocaml-tutorial repo from
CUFP has been handy for some things, especially sexp and binio.

What is the easiest way to contribute docs to core? The bitbucket wiki?

/M

Ashish Agarwal

unread,
Nov 13, 2012, 8:52:39 AM11/13/12
to ocaml...@googlegroups.com
The Core/Async tutorials from 2011 and 2012 are linked below, but they don't mention where the corresponding repos might be.

http://cufp.org/conference/sessions/2012/t1-real-world-ocaml-anil-madhavapeddy-university-c

Francois Berenger

unread,
Nov 13, 2012, 10:58:27 PM11/13/12
to ocaml...@googlegroups.com
On Tuesday, November 13, 2012 12:29:23 PM UTC+9, Dominick LoBraico wrote:
The fact that has probably blocked that is the general vastness of Core. There is an example file for the Command module included with Core I believe (command-line parsing module). If there are specific areas that you would like to see some clarity on I could write up some simple examples for you/the community.

I gave it some thorough thought, that's why I did not reply right away.

1) definitively target the community, not just me, whatever I ask. I may be
    a marginal user of both core and OCaml (I'm in academia in structural
    biology / computer aided drug design, definitively not the mainstream
    typical OCaml user).

2) I think some code example (compiling and working) using the error monad would
    be nice. I would like more of my complex code to not be cluttered with error-
    handling so that it is easier to reason about (and write).

3) Anything that's very different from what is in the OCaml std library might
    be worth some code example, for example core's hash tables.
    I know sometime there is some "bla bla" in wikis / text files, but working and
    compiling code examples are invaluable.
    If you read a lot of UNIX manpages, you will understand this in your guts:
    no matter the amount of "bla bla", no matter who wrote it,
    no matter how well it is written,
    examples are _always_ invaluable (yes, some people will only read
    and use the examples and nothing from the documentation,
    but that's the problem of this kind of user).

Best regards,
Francois.

Reply all
Reply to author
Forward
0 new messages