src/lint/world.bend checks
raw source on the hub · import 0xde9bb08f7de298b03207fb5797ede9a5/src/lint/world.bend as World
src/lint/world: everything bolt reads, as one value. The planner
(src/lint/plan.bend) is a pure function of a World; the interpreter
(src/lint.bend) gathers one, answering each question the planner asks by
IO, and prints the plan the planner returns. The design is
docs/rfc/bolt-lint-planner.md.
The World holds only what the lint reads: the paths named on the command line, the working directory they are named from, and every answer the interpreter gave. A question with no answer yet reads as a directory with no entries or a file that cannot be read.
2 imports
import Base import ../lazy/lazy.bend as Lazy
Types
type Ask source · line 16 · raw
Data
a question the planner asks. Each is answered by one IO action: a directory listed (src/walk/), or a file read (src/lsp/files/).
Entries@dir:String -> Ask
Text@path:String -> Ask
type Answer source · line 23 · raw
Data
the answer to one question. A directory that cannot be opened lists as
empty, as src/walk/dir.c answers. A text asked of a path that is a
directory is Directory, not a read: it has no text.
Listed@names:List<&2, String> -> Answer
Read@text:String -> Answer
UnreadAnswer
DirectoryAnswer
type Reply source · line 30 · raw
Data
one question, answered
Reply@ask:Ask -> @answer:Answer -> Reply
type World source · line 36 · raw
Data
everything bolt reads: the paths named on the command line, the working
directory (absolute) that relative paths are named from, and every answer
the interpreter gave, in the order it gave them
World@paths:List<&2, String> -> @cwd:String -> @replies:List<&2, Reply> -> World
Definitions
def paths.of source · line 40 · raw
@world:World -> List<&2, String>
the paths named on the command line
def cwd.of source · line 45 · raw
@world:World -> String
the working directory the run was started in
def ask.eq source · line 50 · raw
@aa:Ask -> @bb:Ask -> Bool
whether two questions are the same question
def answer.in source · line 62 · raw
@rs:List<&2, Reply> -> @+ask:Ask -> Maybe<&2, Answer>
the first answer given to a question
def answer source · line 70 · raw
@world:World -> @+ask:Ask -> Maybe<&2, Answer>
the answer a World holds for a question, None while there is none
def answered source · line 75 · raw
@world:World -> @+ask:Ask -> Bool
whether a World answers a question
def listing.answer source · line 79 · raw
@aa:Answer -> List<&2, String>
a listing's names; anything else lists nothing
def listing.got source · line 90 · raw
@mm:Maybe<&2, Answer> -> List<&2, String>
def listing source · line 99 · raw
@world:World -> @dir:String -> List<&2, String>
a directory's entries, a sub-directory's name ending in "/"; none while the directory is not listed yet
def text.answer source · line 103 · raw
@aa:Answer -> Maybe<&2, String>
a read's text; anything else is no text
def text.got source · line 114 · raw
@mm:Maybe<&2, Answer> -> Maybe<&2, String>
def text source · line 123 · raw
@world:World -> @path:String -> Maybe<&2, String>
a file's text, or None when it could not be read, is a directory, or is not read yet