[ANN] Encore - encoding/decoding and isomorphism

Hi,

I’m glad to announce the first release of encore. This library is a part of ocaml-git to serialize and deserialize Git objects.

When we develop ocaml-git, we need to write 2 times a description (ABNF) of these objects. One time with angstrom and a second time with an internal implementation of a memory-bounded encoder.

However, when we want to update this description, sometimes, we can forget to update description with the encoder or vice-versa and put a bug - specially when we need to produce exactly what we read. So we found a project, finale, which wants to provide a meta-syntax to produce decoder and encoder both. In this way, we can ensure isomorphism between encoder and decoder and it’s exactly what we want for Git.

We took this idea and provide more strictly an angstrom decoder and an internal encoder. Indeed, finale is focus on to pretty-print a value instead to produce exactly a serialized representation of value equal to what we de-serialize.

You can see an example in this PR or you can look tests which is not really readable …

This library can be used by another encoder/decoder library, however we make this library on top of some constraints about shared behaviors of angstrom and the internal encoder lole - specially about alteration.

Finally, this library was produced explicitly for ocaml-git, so we miss may be some convenience functions for the client. So, feel free to improve it!

6 Likes