src/step.bend checks
raw source on the hub · import ezsys@0.2.0.0/src/step.bend as Step
ezsys/src/step: every decision the file and environment helpers make. It does no IO; src/sys.bend runs the effects and acts on these answers (trusted in src/sys.bend).
1 import
import Base
Types
type Read source · line 7 · raw
Type
after one read: read again with the text so far, or stop with an answer
ReadMore@text:String -> Read
ReadStop@answer:Result<&1, &1, Pair(U32, String), String> -> Read
type Save source · line 12 · raw
Type
after the temporary file is written: rename it, or stop with a failure
SaveMoveSave
SaveStop@error:Pair(U32, String) -> Save
Definitions
def read.chunk source · line 17 · raw
@size:U32 -> U32
the bytes one read asks for: the file's size, and at least 64 KiB
def read.more source · line 21 · raw
@empty:Bool -> @text:String -> @got:String -> Read
a chunk that is empty ends the file; any other is appended
def read.step source · line 29 · raw
@res:Result<&1, &1, Pair(U32, String), String> -> @got:String -> Read
what one read's answer means, with the text read before it
def read.spent source · line 37 · raw
Result<&1, &1, Pair(U32, String), String>
the answer when a file has not ended after every read file.read makes
def save.tmp source · line 41 · raw
@path:String -> String
where file.save writes before it renames
def save.step source · line 45 · raw
@res:Result<&1, &1, Pair(U32, String), Unit> -> Save
what the temporary file's write answer means
def env.pick source · line 53 · raw
@res:Result<&1, &1, Pair(U32, String), String> -> @fallback:String -> String
an environment variable's value, or the fallback when it is unset