Week 44: what's everyone hacking on this week?

Thank you! I may take you up on that! (And as I’ve said before, one of the best parts of OCaml is the community. You guys are great.)

2 Likes

I’ve been working on making ocaml-aws support all the AWS service APIs.

In the process of switching most of my development to OCaml one of the things I know I will need is an AWS SDK. I came across ocaml-aws which in its current state supports only a handful of AWS services.

I went down the rabbit hole a couple weeks ago and yesterday I was finally able to make S3 uploading work! I’m now at a point where most services will just work (for the unaware, the library does OCaml code generation from the AWS service descriptions).

For the curious, my PRs are here and here.

9 Likes

That’s awesome! Great to see the code generator being maintained, so we can keep up with all the newer APIs as they get released as well. Would love to write my Alexa skills in OCaml…

I’ve been working on a piece of code whose main purpose is to delete pieces of other people’s code.

The new Flambda. Coming to a machine near you in 2018.

15 Likes

Still finalizing open statement extension patch (:sweat_smile:), and half-way through implementation of supporting empty variants (type t = |;; let f (x:t) = match x with _ -> .)

7 Likes

Not quite hacking, but working on a series of blog posts to introduce how to write Emacs plugins in OCaml using Ecaml, prompted by a thread a few days ago.

8 Likes

In my evenings I’m toying with the module system typing rules to use as the starting point for the next round of implicits work.

15 Likes

I’ve been working on a SMT solver in OCaml, trying to aim for
performance: https://github.com/c-cube/mc2 .
It’s probably the lowest level algorithmic code I’ve written, it looks
like C++ with a GC; everything is imperative, mutable, and [@inline]
is used with profusion. That… actually yields very good performance,
even compared to what I’m used to from OCaml.

Side note: I’ve been using a pattern that is new to me (yay for OCaml ≥ 4.03):
using open variants to implement an object-like abstraction, but able to
have overloadable equality :


and I must say I also love inline records in variants. It’s a game
changer for performance, as many indirections can be removed.

This week, however, I’m going to rest because I’m out of a job^W^W^W
between jobs :slight_smile:

7 Likes

Today I’ve been trying to come up with an API for input actions in my framebuffer graphics library for Mirage, so that I will be able to switch my dog food’ed slides during my presentation about Mirage tomorrow. :slight_smile:

Also procrastinated a bit, been trying to understand how to make jbuilder output js_of_ocaml'ed code in order to be able to draw in a browser canvas. Mainly to have a uniform interface across various backends, but also because I believe that approach has the potential to save some mobile apps from rendering vulnerabilities like stagefright and worse. Wrote some mock-up code, but I have still to figure out how to make jbuilder compile it. Tips and PRs appreciated!

6 Likes

I’ve been getting Logarion’s jbuild to copy packages files (config, templates) into it’s OPAM share directory when installing via OPAM. But now I’m thinking it would be more portable if it just generates those files. I’d appreciate any thoughts on that.

PS: @avsm great thread, great idea.

5 Likes

I have been trying to pour some effort on OCaml-R, a library that makes it easy to use the R interpreter from OCaml. It was developed long ago by Maxence Guesdon and Guillaume Yziquel, and I have been sort of maintaining it since then. I’m trying to get it ready for a first official release on opam.

4 Likes

In order to learn OCaml, I am still working on improving a Loader for my GObject-Introspection module.

I use this Loader to automatically generate GLib2 bindings based on GObject-Introspection.

The OCaml-GObject-Introspection contains both Ctypes bindings to the GObject-Introspection and OCaml modules that I use in my Loader. Maybe I should just create a package for the GObject-Introspection bindings so that better developpers than me can use it and create bindings for Gtk3 for example.

7 Likes

I am currently refining the ocaml-ffmpeg 0.2.0 API. This version, which should arrive soon enough, will provide the following features:

  • Video color conversion and scaling with Swscale
  • Audio, video and subtitle encoder and decoder with Avcodec
  • Format, input, output and streams reading and writing with Av
  • Audio resampling and sample format conversion with Swresample
  • Special devices access with Avdevice

I do not have much experience in defining a good API so any advice you can give me will be greatly appreciated.
You can take a look at the API here and some use example there.
As @perry pointed out at the beginning of this thread, documentation in the OCaml world has a bad reputation. Also, do not hesitate to criticize my documentation and tell me the best practices to follow to improve this state of affairs. @toots advised me to use polymorphic variants for the binding of declarative types. I will study this question in the next few days. Again, if you know of any examples in this area, that interests me.

PS: @avsm, your thread proposal is just great.

5 Likes
  • fixing user interface bugs for ocaml-gist
  • did some work on compiling cmm towards webassembly
3 Likes

This sounds great. Thanks.

1 Like

I’m working on cross compilation in jbuilder!

I got some hacky working where all the ppx preprocessing is done on the host as expected. Here’s a little teaser build log where 4.05.0 is used as the host and 4.04.2 is the target:

$ (cd _build/4.05.0 && ./.ppx/ppx_sexp_conv/ppx.exe --dump-ast --cookie 'library-name="test"' -o src/test.pp.ml --impl src/test.ml)
$ (cd _build/4.04.2 && ../4.05.0/.ppx/ppx_sexp_conv/ppx.exe --dump-ast --cookie 'library-name="test"' -o src/test.pp.ml --impl src/test.ml)
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamldep.opt -modules src/test.pp.ml) > _build/4.05.0/src/test.depends.ocamldep-output
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.05.0/bin/ocamldep.opt -modules src/test.pp.ml) > _build/4.04.2/src/test.depends.ocamldep-output
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamlc.opt -w -40 -g -bin-annot -I /Users/rgrinberg/.opam/4.05.0/lib/ocaml -I /Users/rgrinberg/.opam/4.05.0/lib/ppx_deriving -I /Users/rgrinberg/.opam/4.05.0/lib/result -I /Users/rgrinberg/.opam/4.05.0/lib/sexplib -I /Users/rgrinberg/.opam/4.05.0/lib/sexplib/0 -no-alias-deps -I src -o src/test.cmo -c -impl src/test.pp.ml)
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamlc.opt -w -40 -g -a -o src/test.cma src/test.cmo)
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.04.2/bin/ocamlc.opt -w -40 -g -bin-annot -I /Users/rgrinberg/.opam/4.04.2/lib/ocaml -I /Users/rgrinberg/.opam/4.04.2/lib/sexplib -I /Users/rgrinberg/.opam/4.04.2/lib/sexplib/0 -no-alias-deps -I src -o src/test.cmo -c -impl src/test.pp.ml)
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.04.2/bin/ocamlc.opt -w -40 -g -a -o src/test.cma src/test.cmo)
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamlopt.opt -w -40 -g -I /Users/rgrinberg/.opam/4.05.0/lib/ocaml -I /Users/rgrinberg/.opam/4.05.0/lib/ppx_deriving -I /Users/rgrinberg/.opam/4.05.0/lib/result -I /Users/rgrinberg/.opam/4.05.0/lib/sexplib -I /Users/rgrinberg/.opam/4.05.0/lib/sexplib/0 -intf-suffix .ml -no-alias-deps -I src -o src/test.cmx -c -impl src/test.pp.ml)
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.04.2/bin/ocamlopt.opt -w -40 -g -I /Users/rgrinberg/.opam/4.04.2/lib/ocaml -I /Users/rgrinberg/.opam/4.04.2/lib/sexplib -I /Users/rgrinberg/.opam/4.04.2/lib/sexplib/0 -intf-suffix .ml -no-alias-deps -I src -o src/test.cmx -c -impl src/test.pp.ml)
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamlopt.opt -w -40 -g -a -o src/test.cmxa src/test.cmx)
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.04.2/bin/ocamlopt.opt -w -40 -g -a -o src/test.cmxa src/test.cmx)
$ (cd _build/4.05.0 && /Users/rgrinberg/.opam/4.05.0/bin/ocamlopt.opt -w -40 -g -shared -linkall -I src -o src/test.cmxs src/test.cmxa)
$ (cd _build/4.04.2 && /Users/rgrinberg/.opam/4.04.2/bin/ocamlopt.opt -w -40 -g -shared -linkall -I src -o src/test.cmxs src/test.cmxa)
12 Likes

Tried looking at what ocaml-gist was. Your github repo should have a paragraph in the README explaining it, or people will not know why your work is cool. :slight_smile:

2 Likes

That’s really neat! Is it cross-version only or would it be able to do cross-arch too?

Yes, the mechanism to compile cross arch will be the same. When cross compiling to a different arch you have an orthogonal problem of needing a retargetted OCaml compiler. whitequark has some repositories where he achieves this through some patches for example. But for something more polished, we’d probably need opam support for building retargetted compilers.

1 Like

I was away talking about generative testing, fuzzers, and CI at a local DevOps conference (where a surprising number of people were a little familiar with OCaml!) early this week, hence the late reply!

I’m using gdb for the first time in anger with OCaml, digging into a segmentation fault I discovered late last week which surfaces when running the ocaml-test-stdlib Crowbar tests with Crowbar’s latest version. My hands remember a bit of how to use gdb as a C REPL, but my brain seems not to be involved. Luckily for me I found this bit of explanatory ephemera on where function arguments go…

6 Likes