package dune-rpc
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=a10386f980cda9417d1465466bed50dd2aef9c93b9d06a0f7feeedb0a1541158
sha512=d1622939713133a1f28617229896298d6ef194c48a47d011e4b752490fc83893cc920a8395d7ac60bc384a6c9b233ebf0665f38f74f2774a983e9d3b241a7746
doc/dune-rpc.private/Dune_rpc_private/Conv/index.html
Module Dune_rpc_private.Conv
Source
Bidirectional parsing of canonical s-expressions
iso t to_ from
creates a parser for a type 'b
out of a parser for a type 'a
, where 'a
and 'b
are isomorphic to one another. The functions to_
and from
convert between the two types 'a
and 'b
. A typical approach for parsing record types is to convert them to/from tuples (via the three
, four
, etc. combinators) which can be parsed with record
, and then use iso
to convert the parser for a tuple type into a parser for the original record type.
parsing records
parsing sums
type error =
| Parse_error of {
message : string;
payload : (string * Stdune.Sexp.t) list;
}
| Version_error of {
since : int * int;
until : (int * int) option;
message : string;
payload : (string * Stdune.Sexp.t) list;
}
conversion from/to
fixpoint f
is a helper for creating parsers of recursive data structures such as ASTs. f
is a function which returns a parser for a single node in the hierarchy, and f
is passed a parser which it can use for parsing children of the current node. fixpoint f
then returns a parser for the recursive data structure.