src/role.bend checks
raw source on the hub · import bolt@1.49.0.0/src/role.bend as Role
src/role: what a file of the run is to the laws -- a law file, a proof
file, or neither. A LAWS.bend is a law file and a PROOF.bend a proof file,
by name, as Bend reads them. Any other file is on the laws' side when a
LAWS.bend or a PROOF.bend reaches it by relative imports and the code does
not: the code is every package's main.bend and every file the laws do not
reach, and all they import. On the laws' side, a file a LAWS.bend reaches is
a law file and any other a proof file, one only a PROOF.bend reaches, so a
proof may state laws of its own. So LAWS.bend can be nothing but
import ./laws/x.bend as X lines, the files it reaches are held to what a
law file is held to, and the code they state laws about, which main.bend
imports, is still code. Pure.
9 imports
import Base import ./paths.bend as Paths import ./src.bend as Src import ./lazy/lazy.bend as Lazy import ./rules/imports.bend as Imports import ./syntax/lex.bend as Lex import ./syntax/outline.bend as Outline import ./finding.bend as F import ./syntax/bind.bend as Bind
Types
type Role source · line 23 · raw
Data
what a file is to the laws
PlainRole
LawsRole
ProofRole
type Fact source · line 71 · raw
Data
one file as the walk reads it: its normalized path, what it imports, its role by name, and whether it is a package's entry (a main.bend)
Fact@norm:String -> @deps:List<&2, String> -> @named:Role -> @entry:Bool -> Fact
type Mark source · line 99 · raw
Data
a file (normalized) and its role
Mark@norm:String -> @role:Role -> Mark
Definitions
def of_path source · line 29 · raw
@+path:String -> Role
a file's role by its name alone: a LAWS.bend, a PROOF.bend, or neither
def is_laws source · line 33 · raw
@rr:Role -> Bool
is it a law file?
def is_proof source · line 41 · raw
@rr:Role -> Bool
is it a proof file?
def is_law_file source · line 49 · raw
@rr:Role -> Bool
is it a law file or a proof file?
def skip source · line 58 · raw
@+rr:Role -> @run:(@_:Unit -> List<&2, 0xc99e5740f06c04139a22cad1ab571855/src/finding.Finding>) -> List<&2, 0xc99e5740f06c04139a22cad1ab571855/src/finding.Finding>
a rule that has nothing to say of a law or proof file: its findings on a file told its role, none on one of those
def reached source · line 66 · raw
@laws:Bool -> Role
what a file on the laws' side is: a law file when a LAWS.bend reaches it, else a proof file
def fact source · line 75 · raw
@ss:0xc99e5740f06c04139a22cad1ab571855/src/src.Src -> Fact
a parsed file read down to its fact
def fact.text source · line 82 · raw
@+path:String -> @+text:String -> Fact
a file's fact read from its text alone: lexed and outlined for its imports, never parsed, so a file read only for its place in the graph costs little
def facts source · line 88 · raw
@ss:List<&2, 0xc99e5740f06c04139a22cad1ab571855/src/src.Src> -> List<&2, Fact>
every file's fact, in order
def edges source · line 103 · raw
@fs:List<&2, Fact> -> List<&2, 0xc99e5740f06c04139a22cad1ab571855/src/rules/imports.Edge>
the import graph of the files
def paths source · line 111 · raw
@fs:List<&2, Fact> -> List<&2, String>
the paths of the files
def roots source · line 119 · raw
@fs:List<&2, Fact> -> List<&2, String>
the roots of the laws: every LAWS.bend and PROOF.bend
def lawful source · line 128 · raw
@fs:List<&2, Fact> -> List<&2, String>
the roots of the law files: every LAWS.bend
def reach source · line 137 · raw
@+fs:List<&2, Fact> -> @+from:List<&2, String> -> List<&2, String>
what the walk from some files reaches, through every file of the run
def code.fast source · line 140 · raw
@fs:List<&2, Fact> -> @+lx:0xc99e5740f06c04139a22cad1ab571855/src/syntax/bind.Index -> List<&2, String>
def code source · line 152 · raw
@fs:List<&2, Fact> -> @+laws:List<&2, String> -> List<&2, String>
the roots of the code: every package's main.bend, and every file the laws do not reach. Each file asks the binder's index (src/syntax/bind.bend) of what the laws reach: a scan of that list for every file is the files squared
def role.of source · line 156 · raw
@+named:Role -> @reach:Role -> Role
a file's role: its role by name, or else its role on the laws' side
def marks.fast source · line 159 · raw
@fs:List<&2, Fact> -> @+lx:0xc99e5740f06c04139a22cad1ab571855/src/syntax/bind.Index -> @+fx:0xc99e5740f06c04139a22cad1ab571855/src/syntax/bind.Index -> @+cx:0xc99e5740f06c04139a22cad1ab571855/src/syntax/bind.Index -> List<&2, Mark>
def marks.of source · line 173 · raw
@fs:List<&2, Fact> -> @+laws:List<&2, String> -> @+lawful:List<&2, String> -> @+code:List<&2, String> -> List<&2, Mark>
the marks of the files the laws reach and the code does not, in the run's order: a law file when a LAWS.bend reaches it. What each walk reaches is put in the binder's index once, and each file asks the three indexes, where three scans for every file were the files squared (1.7 s of the 5 s the marks took on a project of 4,062 files)
def marks.facts source · line 182 · raw
@+fs:List<&2, Fact> -> List<&2, Mark>
the role of every file on the laws' side of a graph given as facts
def marks source · line 189 · raw
@ss:List<&2, 0xc99e5740f06c04139a22cad1ab571855/src/src.Src> -> List<&2, Mark>
the role of every file on the laws' side. Both walks are the one every project rule takes over imports (src/rules/imports.bend), each from all its roots at once
def of.norm source · line 194 · raw
@ms:List<&2, Mark> -> @+nn:String -> Role
a normalized path's role among the marks: neither when it is not marked
def of source · line 203 · raw
@ms:List<&2, Mark> -> @+path:String -> Role
a file's role among the marks: a LAWS.bend or PROOF.bend by its name, any other file as marked, and neither when it is not marked