package data-encoding

  1. Overview
  2. Docs

Create a Data_encoding.t value which records knowledge of older versions of a given encoding as long as one can "upgrade" from an older version to the next (if upgrade is impossible one should consider that the encoding is completely different).

See the module Documented_example in "./test/" for a tutorial.

type _ t

An encapsulation of consecutive encoding versions.

val first_version : 'a encoding -> 'a t

first_version enc records that enc is the first (known) version of the object.

val next_version : 'a encoding -> ('b -> 'a) -> 'b t -> 'a t

next_version enc upgrade prev constructs a new version from the previous version prev and an upgrade function.

val encoding : name:string -> 'a t -> 'a encoding

Make an encoding from an encapsulation of versions; the argument ~name is used to prefix the version "tag" in the encoding, it should not change from one version to the next.


Innovation. Community. Security.