Module B0_unit

Build units.

A build unit is a named build procedure with metadata associated to it. Build units are the smallest unit of build in B0.

Build procedures

type build

The type for builds, see B0_build.

type proc = build -> unit B00.Memo.fiber

The type for unit build procedures.

val nop : proc

nop does nothing.

Units

type t

The type for build units.

val v : ?⁠doc:string -> ?⁠meta:B0_meta.t -> string -> proc -> t

v n ~doc ~meta is a build unit named n with build operations run and described by doc.

val proc : t -> proc

proc u are the unit's build operations.

include B0_def.S with type t := t
type t

The type of defined values.

val define : ?⁠doc:string -> ?⁠meta:B0_meta.t -> string -> B0_def.def

define ~doc ~meta n defines name n in the current scope with documentation string doc (defaults to "undocumented")e and metadata meta (defaults to B0_meta.empty). Defining a duplicate value in a scope raises Duplicate.

val def_kind : string

def_kind is the kind of defined value.

val def : t -> B0_def.def

def v is the definition of value v.

val name : t -> string

name v is v's name.

val doc : t -> string

doc v is v's documentation string.

val meta : t -> B0_meta.t

meta v is v's metadata.

val equal : t -> t -> bool

equal v0 v1 is true iff v0 and v1 have the same name.

val compare : t -> t -> int

compare v0 v1 sorts v0 and v0 in lexicographical order.

Add & Lookup

val add : t -> unit

add v adds the value v to the list of defined values.

val list : unit -> t list

list () is the list of units. FIXME scope that.

val find : string -> t option

find n is the value named n (if any).

val get : string -> t

get n looks up the value named n and errors the B0 file if there no such n.

val get_or_suggest : string -> (tt list) Stdlib.result

get_or_suggest n is the value named n or a (possibly empty) list of suggested values whose name could match n.

val get_all : string list -> (t list, string) Stdlib.result

get_all ns are the value named ns or an error that indicates the names that could not be found with suggested names. If ns is empty then list is returned.

Formatters

val pp_name_str : string B00_std.Fmt.t

pp_name_str v pretty prints value names.

val pp_name : t B00_std.Fmt.t

pp_name v formats v's name.

val pp_doc : t B00_std.Fmt.t

pp_doc formats v's doc string.

val pp_synopsis : t B00_std.Fmt.t

pp_synopsis formats v's name and its doc string.

val pp : t B00_std.Fmt.t

pp formats v 's name, its doc string and its metadata dictionary.

Value set and maps

module Set : Stdlib.Set.S with type Set.elt = t

Value sets.

module Map : Stdlib.Map.S with type Map.key = t

Value maps.