package yocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=89a74bd5cb37e580e45e4ed3d43b07b2cca5af9ab7f98966c48fe9730dc4af2e
sha512=ae77555570320c28c47d748e75056ccc44bb43cddf6fef70e8b556254fd809d67b915b313bd1833c28581db1fdeefbe34e81d5548744d6ecabe466ee1ef6284c
doc/yocaml/Yocaml/Data/index.html
Module Yocaml.DataSource
Describes an mostly compatible Ezjsonm AST that acts as a generic AST for describing metadata that can be exchanged between source documents and templates. To summarise, source metadata is ultimately projected into a value of type Yocaml.Data.t and data injected into templates is projected from values of type Yocaml.Data.t.
To be generic, you need to provide a module capable of transforming the AST of arbitrary metadata (for example, Yaml) into a value of type Yocaml.Data.t to be used generically.
Types
type ezjsonm = [ | `Null| `Bool of bool| `Float of float| `String of string| `A of ezjsonm list| `O of (string * ezjsonm) list
]Describes type ezjsonm (to be compatible with historical libraries, such as ocaml_yaml).
Creating Data values
Generic Data values
Building generic Data values.
pair f g (x, y) construct a pair as a t. A pair has the structure {"fst": a, "snd": b}.
triple f g h (x, y, z) is pair f (pair g h) (x, (y, z)). It use pair to define triple.
quad f g h i (w, x, y, z) is pair f (triple g h) (w, (x, y, z))
either f g x construct either as a t. Either has the structure {"constr": "left | right", "value": e}.
Specific Data values
Validating Data values
Used to validate data described by type Yocaml.Data.t to build validation pipelines. The aim of this module is to produce combinators for building validation pipelines that support nesting and that can transform any value described by the AST in Data into arbitrary OCaml values.
Conversion signature
Modules that convert OCaml values into Yocaml.Data.t values.
Using conversion modules
into (module M) v applies M.to_data from the given conversion module M to the OCaml value v, producing a Yocaml.Data.t.
Validation helper types
('a, 'b) validator validates a value of type 'a and returns a Yocaml.Data.Validation.validated_value of type 'b.
'a validable is a validator that takes a value of type t and returns a validated value of type 'a.
Utils
Pretty-printer for t (mostly used for debugging issue).
to_sexp convert to a Yocaml.Sexp.t.