Explorer

core

Core built-in module for definy · Public

Snapshot history

Status: Done · Every branch of the project (change the status there)

core.branch-merge: Type  // A snapshot of the main branch of a project that merged another snapshot (merged_commit_hash), with its time (milliseconds). core.branch-status-of treats it as making the merged branch done
core.branch-status-of: Fn(
    project_name: String,
    branch: String,
    creator_account_id: String,
    latest_event_hash: String,
    records: List<@core.branch-status-record>,
    merges: List<@core.branch-merge>
  ) -> @core.branch-status  // (en) The status of a branch (not main): the newest of the status changes by its creator (project_branch_status) and the merges of its latest snapshot into main (which mean done). In progress if there is neither. A change at the same time as a merge wins. See docs/branch.md (ja) ブランチ (main 以外) の状態: 作成者の状態の変更 (project_branch_status) と, ブランチの最新のスナップショットの main への取り込み (完了とみなす) のうち新しいもの。どちらも無ければ開発中。取り込みと同じ時刻の変更は変更が勝つ。docs/branch.md を参照
core.branch-status-name: Fn(status: @core.branch-status) -> String  // The name of a branch status in events and JSON: in_progress, review or done
core.branch-status-from-name: Fn(name: String) -> Union{#none, #some(@core.branch-status)}  // The branch status of a name (in_progress, review or done; core.branch-status-name). none for another name
core.value-to-branch-status: Fn(value: @core.value) -> Union{#none, #some(@core.branch-status)}  // Read a value of the evaluator (core.value) as core.branch-status. none if the shape differs
core.branch-status-to-value: Fn(value: @core.branch-status) -> @core.value  // Turn core.branch-status into a value of the evaluator (core.value). The inverse of core.value-to-branch-status
core.value-to-branch-status-change: Fn(value: @core.value) -> Union{#none, #some(@core.branch-status-change)}  // Read a value of the evaluator (core.value) as core.branch-status-change. none if the shape differs
core.branch-status-change-to-value: Fn(value: @core.branch-status-change) -> @core.value  // Turn core.branch-status-change into a value of the evaluator (core.value). The inverse of core.value-to-branch-status-change
core.event-check-state-of-branch: Fn(project_name: String, branch: String, facts: @core.event-check-facts) -> @core.event-check-state  // What the rules know about an event on an existing branch that is not a snapshot (project_branch_status): the latest snapshot of the branch (none if there is no such branch), whether the account created the branch, and whether the project has any snapshot. The fields only for snapshots are false or empty
core.check-event-branch-status: Fn(change: @core.branch-status-change, state: @core.event-check-state) -> List<@core.event-rejection>  // Rules of a branch status change (project_branch_status): main has no status, the branch must exist, and only its creator can change its status (the same as taking snapshots on it). See docs/branch.md
core.branch-summary-status: Fn(
    branch: @core.branch-summary,
    records: List<@core.branch-status-record>,
    merges: List<@core.branch-merge>
  ) -> Union{#none, #some(@core.branch-status)}  // (en) The status of a branch summarized by core.project-branches (core.branch-status-of). none for main, which has no status (ja) core.project-branches がまとめたブランチの状態 (core.branch-status-of)。main は状態を持たないので none
core.test-branch-status-of-defaults-to-in-progress: Boolean  // A branch without status changes or merges is in progress
core.test-branch-status-of-merge-of-the-latest-snapshot-is-done: Boolean  // Merging the latest snapshot of a branch into main after its status change makes it done, but merging an older snapshot does not
core.test-branch-status-of-newest-change-by-the-creator-wins: Boolean  // The newest status change by the creator of the branch wins over an older merge and older changes; changes by other accounts and of other branches are ignored
core.test-check-event-branch-status: Boolean  // core.check-event accepts a status change of a branch by its creator, and rejects it by another account (not_branch_creator), on main (main_branch_has_no_status) and of a branch that does not exist (branch_not_found)
core.test-branch-status-event-content-value-round-trip: Boolean  // A project_branch_status event content turned into a value (core.event-content-to-value) reads back the same (core.value-to-event-content)
core.compile-module: Fn(
    expr: @core.expression,
    parts: List<Record{id: String, expression: @core.expression}>,
    quote_parts: List<Record{id: String, expression: @core.expression}>
  ) -> List<Number>  // (en) Compile an expression into a Wasm module (core.compile-to-wasm without the constant folding). parts are the parts to compile with it; quote_parts are the parts that quote(...) follows to collect the referenced part IDs (core.quote-value), the parts before core.compile-fold-constant-parts so that a quote still lists the parts a folded constant part referred to (ja) 式を Wasm モジュールにコンパイルする (定数畳み込みをしない core.compile-to-wasm)。parts は一緒にコンパイルするパーツ。quote_parts は quote(...) が参照するパーツの ID を集めるときに辿るパーツ (core.quote-value) で, 畳み込んだ定数パーツが参照していたパーツも quote が並べるよう core.compile-fold-constant-parts の前のパーツを渡す
core.compile-to-wasm-without-folding: Fn(expr: @core.expression, parts: List<Record{id: String, expression: @core.expression}>) -> List<Number>  // core.compile-to-wasm without computing the constant parts at compile time (it compiles the parts the code needs, core.compile-reachable-parts). For the compiled tests (definy.run-compiled-tests), which must run the compiled code of the tests rather than the values core.eval-value computed
core.compile-time-constant-candidate: Fn(expr: @core.expression, index: List<List<Record{id: String, expression: @core.expression}>>) -> Boolean  // Whether core.compile-fold-constant-parts tries to compute a part with this expression at compile time: a call, let, match, record, list, variant, record_get, part reference or quote that is not a type (core.compile-type-level). Not a function, a built-in, a literal, a type or a secret
core.compile-fold-constant-parts: Fn(parts: List<Record{id: String, expression: @core.expression}>) -> List<Record{id: String, expression: @core.expression}>  // The parts with each constant part (core.compile-time-constant-candidate) replaced by the literal of its value, computed at compile time by core.eval-value with these parts (core.value-literal). A part whose value is not a literal (a function, a float, a long list) or cannot be computed stays as it is. See docs/compile-time-evaluation.md
core.value-literal: Fn(value: @core.value) -> Union{#none, #some(@core.expression)}  // The literal expression of a value of core.eval-value: numbers, strings, booleans, and lists (up to 1000 items, within the limit of array.new_fixed), records and variants of them. none for a function, a built-in, a float, unit (a failed computation) or a longer list
core.value-literal-list: Fn(items: List<@core.value>) -> Union{#none, #some(List<@core.expression>)}  // The literal expressions of the values (core.value-literal), or none if one of them has none
core.value-literal-fields: Fn(fields: List<Record{key: String, value: @core.value}>) -> Union{#none, #some(List<Record{key: String, value: @core.expression}>)}  // The record literal fields of the fields of a record value (core.value-literal), or none if one of them has none
core.test-value-literal-round-trip: Boolean  // The literal of a value made of numbers, strings, booleans, lists, records and variants (core.value-literal) evaluates back to the same value
core.test-value-literal-of-a-function-is-none: Boolean  // A value with a function inside, and a list longer than 1000 items, have no literal (core.value-literal)
core.test-compile-fold-constant-parts: Boolean  // core.compile-fold-constant-parts replaces a constant part (a call) by the literal of its value, also when it refers to another part, and keeps a function part and a part whose value is a function
core.quote-part-ids-from: Fn(
    frontier: List<String>,
    found: List<String>,
    index: List<List<Record{id: String, expression: @core.expression}>>
  ) -> List<String>  // (en) found with the ids of frontier and of the parts they reference (following the references through index, a core.list-hash-index of the parts by id). Each step adds the new ids of frontier and makes the next frontier from the references of their parts; it calls itself in the tail position. An id without a part in index is added but not followed (ja) found に frontier の id と, それが (index をたどって) 参照するパーツの id を足したもの。index はパーツの id による core.list-hash-index。1 段ごとに frontier の新しい id を足し, それらのパーツの参照から次の frontier を作り, 末尾位置で自分を呼ぶ。index にパーツが無い id は足すがたどらない
core.test-quote-part-ids-follows-references-breadth-first: Boolean  // core.quote-part-ids collects every part the expression references transitively, once each, also through a cycle, nested quotes and type expressions, and keeps an id without a part
core.compile-type-level: Fn(expr: @core.expression, index: List<List<Record{id: String, expression: @core.expression}>>) -> Boolean  // Whether the expression is a type: a type expression (core.is-type-expression), a reference to a part that is a type, or a call of a part that is a function returning a type expression (a type application such as definy.service-io = @definy.io(A: ...)). index is a core.list-hash-index of the parts by id
core.test-compile-fold-constant-parts-keeps-types: Boolean  // core.compile-fold-constant-parts keeps a type application (a call of a function returning a type expression) and a reference to a type part as they are
core.quote-parts: Fn(ids: List<String>, parts: List<Record{id: String, expression: @core.expression}>) -> String  // The definitions {id, expression} of the parts with the ids as one string: core.encode-value of the list of records (the expression by core.expression-to-value). core.code-parts reads it back. An id without a part in parts is left out. One string, so a compiled quote holds the definitions as string data and not as instructions that build them
core.test-quote-has-the-parts-to-compile: Boolean  // A quote has the definitions of the parts it references as one string (code.encoded_parts, core.quote-parts), here computed in the evaluator (core.eval-value), and core.code-parts reads it back into the definitions that core.compile-to-wasm takes
core.test-compile-quoted-code-at-run-time: Boolean  // core.compile-to-wasm of quoted code (code.expression with core.code-parts of code.encoded_parts) gives a Wasm module also when this test is compiled and run (definy_run_tests compiled), not only when computed at compile time
core.eval-native-value-to-parts: Fn(items: List<@core.value>) -> Union{#none, #some(List<Record{id: String, expression: @core.expression}>)}  // The parts {id, expression} of values (records with an id string and an expression value, read by core.value-to-expression), or none if one has another shape. For core.code-parts, and for core.compile-to-wasm run natively by core.eval-value
core.test-quote-expression-reads-back: Boolean  // The value that core.quote-expression builds reads back as the same expression (core.value-to-expression), also for let (variable_name) and secret (allowed_url_prefixes), so quoted code can be compiled from its value
core.number-text: Fn(value: Number) -> String  // The decimal text of a number (- before a negative number). For core.encode-value
core.encode-value: Fn(value: @core.value) -> String  // A short string of a value of the evaluator (core.value), read back by core.decode-value: n<number>; s<byte length>:<bytes> t f u l<count>:<items> r<count>:<key value...> v<tag><payload>. Floats, closures and builtins become u. quote uses it to keep the parts' expressions as strings (core.encode-expression)
core.decode-digits: Fn(bytes: List<Number>, index: Number, value: Number) -> Record{value: Number, next: Number}  // Reads the decimal digits from index on into value (value * 10 + digit for each digit). next is the index after the digits. For core.decode-value
core.decode-number-until: Fn(bytes: List<Number>, index: Number, end: Number) -> Union{#none, #some(Record{value: Number, next: Number})}  // Reads a decimal number (- for a negative one) from index on that ends with the byte end. next is the index after end. none if end does not follow. For core.decode-value
core.decode-value-at: Fn(text: String, bytes: List<Number>, index: Number) -> Union{#none, #some(Record{value: @core.value, next: Number})}  // Reads a value written by core.encode-value from index on in text (bytes are text's bytes). next is the index after it. none if it is not written that way
core.decode-value-items: Fn(text: String, bytes: List<Number>, index: Number, count: Number, items: List<@core.value>) -> Union{#none, #some(Record{items: List<@core.value>, next: Number})}  // Reads count more values (core.decode-value-at) from index on after items. It reads the first half and then the rest, so a long list does not need deep recursion
core.decode-value-fields: Fn(
    text: String,
    bytes: List<Number>,
    index: Number,
    count: Number,
    fields: List<Record{key: String, value: @core.value}>
  ) -> Union{#none, #some(Record{fields: List<Record{key: String, value: @core.value}>, next: Number})}  // (en) Reads count more record fields (a string key then a value, core.decode-value-at) from index on after fields. It reads the first half and then the rest, so a long record does not need deep recursion (ja) index から, さらに count 個のレコードの項目 (文字列のキーと値, core.decode-value-at) を読んで fields の後に足す。前半を読んでから残りを読むので, 長いレコードでも再帰が深くならない
core.decode-value: Fn(text: String) -> Union{#none, #some(@core.value)}  // The value that core.encode-value wrote as text, or none if text is not written that way
core.encode-expression: Fn(expression: @core.expression) -> String  // A short string of an expression (core.encode-value of core.expression-to-value), read back by core.decode-expression. quote keeps the referenced parts' expressions this way (core.code), so that a compiled quote holds them as string data and not as instructions that build them
core.decode-expression: Fn(text: String) -> Union{#none, #some(@core.expression)}  // The expression that core.encode-expression wrote as text, or none if text is not written that way
core.code-parts: Fn(encoded: String) -> List<Record{id: String, expression: @core.expression}>  // The definitions {id, expression} of the parts that quoted code references, read from code.encoded_parts (core.quote-parts). core.compile-to-wasm(expr: code.expression, parts: core.code-parts(encoded: code.encoded_parts)) compiles the code, the same way at run time and at compile time. Empty if encoded is not written that way
core.compile-collect-quote-strings: Fn(
    expr: @core.expression,
    parts: List<Record{id: String, expression: @core.expression}>,
    strings: List<String>
  ) -> List<String>  // (en) Adds the string of the parts' definitions that each quote in expr holds (core.quote-parts, following the references in parts) to strings, so that the compiled quote holds it as string data (core.compile-module) (ja) expr の中の quote が持つパーツの定義の文字列 (core.quote-parts, parts で参照先をたどる) を strings に足す。コンパイルした quote がそれを文字列のデータで持てるようにする (core.compile-module)
core.test-encode-value-round-trip: Boolean  // core.decode-value reads back what core.encode-value wrote (numbers, strings with multi-byte characters, booleans, unit, lists, records and variants), and the text is short
core.test-encode-expression-round-trip: Boolean  // core.decode-expression reads back what core.encode-expression wrote, here for a quoted expression with let, match, a negative number and a string with quotes and multi-byte characters (encoding it again gives the same string)
core.test-quoted-code-evaluates-to-the-compiled-result: Boolean  // Quoted code evaluated by the evaluator (core.eval-value with core.code-parts of code.encoded_parts) gives the same value as the same expression run directly. Run compiled (definy_run_tests compiled), this compares the evaluator with the compiled code
core.test-decode-a-long-list: Boolean  // core.decode-value reads a list of 5000 items (without deep recursion, core.decode-value-items)
core.compile-string-data-range: Fn(strings: List<String>, lo: Number, hi: Number) -> List<Number>  // The bytes of the strings from lo up to hi, one after another (the first half then the second half)
core.compile-part-references: Fn(expr: @core.expression, ids: List<String>) -> List<String>  // Adds to ids the part IDs that the compiled code of the expression needs: like core.expression-part-references, but not inside quotes (a compiled quote holds the parts it references as string data, core.quote-parts). Each ID is added once
core.compile-reachable-ids-from: Fn(
    frontier: List<String>,
    found: List<String>,
    index: List<List<Record{id: String, expression: @core.expression}>>
  ) -> List<String>  // (en) found with the ids of frontier and of the parts they reference (core.compile-part-references, following the references through index, a core.list-hash-index of the parts by id), breadth first like core.quote-part-ids-from (ja) found に frontier の id と, それが (index をたどって) 参照するパーツの id (core.compile-part-references) を足したもの。core.quote-part-ids-from と同じく幅優先にたどる
core.compile-parts-of: Fn(ids: List<String>, parts: List<Record{id: String, expression: @core.expression}>) -> List<Record{id: String, expression: @core.expression}>  // The parts with the ids, in the order of ids. An id without a part in parts is left out
core.compile-reachable-parts: Fn(expr: @core.expression, parts: List<Record{id: String, expression: @core.expression}>) -> List<Record{id: String, expression: @core.expression}>  // The parts that the compiled code of expr needs: the parts it references, following the references but not into quotes (core.compile-part-references). core.compile-to-wasm compiles only these, so parts may hold more parts than the expression uses
core.test-compile-reachable-parts: Boolean  // core.compile-reachable-parts takes the parts the expression references (following the references) but not those referenced only inside a quote, nor unused ones

501–557 (of 557) Previous 100