gleamunison/publication

The evidence turnstile as a reusable operation, independent of CLI I/O.

Types

Why publication was refused.

MissingEvidence carries the refused subjects so a caller can render the evidence turnstile’s guidance; Failed carries an already-rendered reason for policy, storage, or namespace failures.

pub type AdmitError {
  MissingEvidence(subjects: List(Subject))
  Failed(reason: String)
}

Constructors

  • MissingEvidence(subjects: List(Subject))
  • Failed(reason: String)

A named, content-addressed definition selected for publication.

pub type Subject {
  Subject(
    name: String,
    content_ref: String,
    definition: ast.Definition,
  )
}

Constructors

  • Subject(
      name: String,
      content_ref: String,
      definition: ast.Definition,
    )

Values

pub fn admit(
  adapter: storage.StorageAdapter,
  directory: String,
  branch: String,
  selected: List(Subject),
) -> Result(Nil, AdmitError)

Admit selected subjects through the evidence turnstile, store their content, and bind their names on the target branch.

pub fn describe_error(error: AdmitError) -> String

Render an admission refusal as the canonical CLI guidance.

pub fn hash_defs(
  names: List(String),
  definitions: List(#(String, elab_types.SurfaceDef)),
  cache: types.TypeCache,
) -> Result(List(#(String, String, Bool)), String)

Elaborate definitions into evidence triples: name, content ref, effectful.

Effectfulness is computed across the whole batch, so a pure caller of an effectful batch member still requires evidence.

pub fn subjects(
  names: List(String),
  definitions: List(#(String, elab_types.SurfaceDef)),
  cache: types.TypeCache,
) -> Result(List(Subject), String)

Elaborate definitions into publishable subjects.

pub fn term_names(
  names: List(String),
  definitions: List(#(String, elab_types.SurfaceDef)),
) -> List(String)

Keep only names that bind surface term definitions.

✨ Search Document