Previous week Up Next week

Hello

Here is the latest OCaml Weekly News, for the week of March 22 to 29, 2016.

  1. opam-builder bot and opam-file website
  2. Is it possible to get back some OCaml code after ppx processing ?
  3. gen_js_api 1.0, easy OCaml bindings for Javascript libraries
  4. Other OCaml News

opam-builder bot and opam-file website

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00265.html

Fabrice Le Fessant announced:
I am pleased to announce that the "opam-builder" service 1.0 is
online and running on:

http://opam.ocamlpro.com/builder/html/report-last.html

opam-builder is a bot, that compiles all the versions of all the
packages in the OPAM repository on a Linux Debian 8 amd64 computer,
for OCaml 3.12.1, 4.00.1, 4.01.0, 4.02.3 and 4.03.0+beta1.

If you maintain an OPAM package, you should check there from time to
time to verify that your package can still be compiled.

It tries to keep up with the OPAM repository, in a best effort way,
given that the server running it is not very powerful (4-core, no
hyper-threads, standard SATA disks). Compiling the full repository on
one OCaml version can take one or two days, but next compilations are
incremental (only impacted packages are recompiled, and binary
archives are used to re-use previous compilations), so a report for
every commit should be available after only a few minutes/hours,
depending on the number of packages that need to be recompiled.

Using the archives built by opam-builder, we have also set up a
simple website (an opam-file like) showing the modules installed by
all packages. If you wonder which package provides a given module or
from which version a function is available, it might help you:

http://opam.ocamlpro.com/builder/html/api.4.02.1/

The availability of a module or function in a given package is shown, with its
type, in a file called @PACKAGE.VERSION.txt.

The sources of opam-builder are available on Github, if you want to
start it on a different hardware/OS:

https://github.com/OCamlPro/opam-builder

Feedback and PRs are welcome !
      

Is it possible to get back some OCaml code after ppx processing ?

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00274.html

Francois Berenger asked:
I am completely new to the -ppx option of the compiler, so please
forgive in advance my (probably stupid) two questions.

Here is some example code:
---
type t = {
  i: int;
  f: float
} [@@deriving sexp]
---

1) I'd like to see all the functions automatically created
by the magical spell "[@@deriving sexp]".
At least their names and type signatures would be nice.
How to do that?

2) If that's not possible, I'd like to get back some
OCaml code corresponding to the AST after ppx processing.
If that's possible, how to do that?
      
Louis Roché suggested:
1) With utop, you will get what you want:

utop # type t = {
i: int;
f: float
} [@@deriving eq,show];;
type t = { i : int; f : float; }
val equal : t -> t -> bool = <fun>
val pp : Format.formatter -> t -> unit = <fun>
val show : t -> bytes = <fun>

2) I believe that you are looking for an option like -dsource for ocamlc
      
Goswin von Brederlow added:
'ocamlc -i' should work too.
      
Jeremie Dimino also replied:
For the case of Jane Street ppx rewriters (assuming you are using
ppx_sexp_conv), you can install ppx_jane and do:

ppx-jane file.ml
      
Nicolas Ojeda Bar also replied:
You can use ppx_tools (https://github.com/alainfrisch/ppx_tools) to do it:

ocamlfind ppx_tools/rewriter ./my_ppx_rewriter foo.ml
      

gen_js_api 1.0, easy OCaml bindings for Javascript libraries

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2016-03/msg00285.html

Alain Frisch announced:
It's my pleasure to announce the first public release of gen_js_api, a new FFI
tool to bind to Javascript code from OCaml.

gen_js_api relies on js_of_ocaml's compiler and runtime system, but *not* its
standard library nor its camlp4/ppx language extension.  In the future
gen_js_api could support (with the same binding definitions) alternatives ways
to combine OCaml and Javascript, such as Bucklescript or direct embedding of a
JS engine into a native OCaml application.

The tool has been developed at LexiFi mostly by Sebastien Briais and me; it has
been used internally for several months in production.

Project page: https://github.com/LexiFi/gen_js_api

Available in OPAM:

  opam install gen_js_api


(Note: gen_js_api requires OCaml 4.03.)


Enjoy, and please drop us a note if you use this tool!  We'd love to hear some
feedback.
      

Other OCaml News

From the ocamlcore planet blog:
Here are links from many OCaml blogs aggregated at OCaml Planet,
http://ocaml.org/community/planet/.

forge.ocamlcore.org NOT reported as unsafe anymore
 http://forge.ocamlcore.org/forum/forum.php?forum_id=931

forge.ocamlcore.org reported as unsafe in Firefox/Chrome 
 http://forge.ocamlcore.org/forum/forum.php?forum_id=930

REPLs
 http://blog.shaynefletcher.org/2016/03/repls.html

Full Time: Software Developer (Functional Programming) at Jane Street in New York, NY; London, UK; Hong Kong
 http://jobs.github.com/positions/0a9333c4-71da-11e0-9ac7-692793c00b45
      

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.


Alan Schmitt