explain

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package explain derives English contract instructions from checked syntax. It does not execute predicates, simplify arbitrary functions, or claim that native schema keywords can enforce the additional rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Name      string
	Signature string
	English   string
}

type Document

type Document struct {
	// contains filtered or unexported fields
}

func Generate

func Generate(program *language.Program) (Document, error)

Generate describes every declaration, clause and function body, including recursive algorithms. References are not expanded, so recursive contracts produce finite documents. Only compiler-checked source is accepted.

func GeneratePayload

func GeneratePayload(target *language.PayloadType) (Document, error)

GeneratePayload also includes anonymous constraints authored on a selected closed target outside the module, such as Box (Int where it > 0).

func (Document) Definitions

func (d Document) Definitions() []Definition

func (Document) Equations

func (d Document) Equations() []Equation

func (Document) Instructions

func (d Document) Instructions() []Instruction

func (Document) Limits

func (d Document) Limits() SchemaLimits

func (Document) Markdown

func (d Document) Markdown() string

Markdown is deterministic and self-contained; code fences grow to contain arbitrary author text safely. It includes all algorithms, not just summaries.

func (Document) MarshalJSON

func (d Document) MarshalJSON() ([]byte, error)

func (Document) Rules

func (d Document) Rules() []Rule

type Equation

type Equation struct {
	Function string
	Patterns []string
	English  string
	Entry    string
}

type Instruction

type Instruction struct {
	ID      string
	English string
}

type Rule

type Rule struct {
	Owner        string
	Location     string // Syntax location, not a concrete runtime payload path.
	Code         string // Empty means the runtime derives a code for each payload path.
	Offset       int
	Predicate    string
	Entry        string
	Message      string
	MessageEntry string
	Steps        uint64
}

type SchemaLimits

type SchemaLimits struct {
	Total         uint64 `json:"total"`
	Clause        uint64 `json:"clause"`
	TotalDefault  bool   `json:"totalDefault"`
	ClauseDefault bool   `json:"clauseDefault"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL