# \[ANN\] Encore - encoding/decoding and isomorphism

**URL:** https://discuss.ocaml.org/t/ann-encore-encoding-decoding-and-isomorphism/1806
**Category:** Community
**Tags:** announce, encoder, decoder, isomorphism
**Created:** [April 3, 2018, 2:58pm UTC](https://discuss.ocaml.org/t/ann-encore-encoding-decoding-and-isomorphism/1806 "2018-04-03T14:58:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dinosaure](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/dinosaure/32/16_2.png) [@dinosaure](https://discuss.ocaml.org/u/dinosaure)
#### Post date: [April 3, 2018, 2:58pm UTC](https://discuss.ocaml.org/t/ann-encore-encoding-decoding-and-isomorphism/1806/1 "2018-04-03T14:58:14Z")

</div>

Hi,

I’m glad to announce the first release of [encore](https://github.com/dinosaure/encore). This library is a part of [ocaml-git](https://github.com/mirage/ocaml-git) to serialize and deserialize Git objects.

When we develop `ocaml-git`, we need to write 2 times a description ([ABNF](https://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_form)) of these objects. One time with [angstrom](https://github.com/inhabitedtype/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](https://github.com/takahisa/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](https://github.com/mirage/ocaml-git/pull/287) or you can look [tests](https://github.com/dinosaure/encore/blob/master/test/test.ml) 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`](https://github.com/dinosaure/encore/blob/master/lib/lole.mli) - specially about alteration.

Finally, this library was produced explicitly for [ocaml-git](https://github.com/mirage/ocaml-git), so we miss may be some convenience functions for the client. So, feel free to improve it!
