package pidgin

  1. Overview
  2. Docs
A common language for describing and validating data structures

Install

dune-project
 Dependency

Authors

Maintainers

Sources

pidgin-1.2.0.tbz
sha256=c6bb3f9332bcefc0488f03fcfa75e86cfa43a96e64cc4c293a9c37006c5f9785
sha512=887ac838a474d148abaeecb08d117bcca44d3c78ede7f1d81bb45930f1a5941085a6a1d9ab9ac4df44105dcff140569d1eb67088e223ca51fe4d5ea81be1b2ce

doc/pidgin/Pidgin/index.html

Module PidginSource

Pidgin is a generic key-value data structure description language that enables fine-grained validation to deal with format like JSON, S-expression, Yaml, ToML etc.

The main idea is to present a minimal representation (very similar to that of JSON) and to provide:

  • a DSL for describing arbitrary data structures in this language (see Repr).
  • Validation functions that operate on data described using this DSL (see Check).
  • Repr and Check can be combined using Prism.
  • A bidirectional conversion approach (see Driver), imposing a cost due to the indirect nature of the generic format (though it is viable in many scenarios).

Pidgin does not statically preserve the type of expressions; instead, it hides them, which allows expressions written in this language to be treated as an untyped runtime representation of arbitrary OCaml values (enabling the derivation of pretty-printers and equality functions, for example).

Data Representation

Sourcemodule Repr : sig ... end

Broadly speaking, Pidgin describes a "generic" key-value language that serves as an intermediate format between several other key-value formats (such as JSON, TOML, YAML, etc.). Repr describes the abstract representation of this language.

Sourcemodule Kind : sig ... end

A Kind is a type of light type. It holds less information than a full-fledged type system and is used primarily for generating error messages (and perhaps, in the near future, for defunctionalize validation functions). Naively, they can be viewed as a representation that does not hold the value of a term described by Repr.t.

Data Validation

Sourcemodule Check : sig ... end

Describes a validation tree for validating complex structured data from Repr.t.

Drivers

Sourcemodule Driver : sig ... end

A driver allows Pidgin to be used as an exchange format. It exposes two signatures that enable conversion to Repr.t and conversion from Repr.t, respectively.

S-Expression

S-expressions make it easy to serialize Pidgin expressions; however, the format was designed to be used with any key-value representation.

Sourcemodule Sexp : sig ... end

A minimalist library for describing and parsing S-expression.

Sourcemodule Csexp : sig ... end

A minimalist library for describing and parsing Canonical S-expression.

Misc

Sourcemodule Prism : sig ... end

A Prism is used to describe a codec that enables serialization and deserialization (it consists of a Repr.conv and a Check.t pair).

Sourcemodule Misc : sig ... end