src/argv.bend checks
raw source on the hub · import 0x103d0af04de36ab98b311e537366ec67/src/argv.bend as Argv
src/argv: what run, exec and start do with an argv. run.plan decides
whether it can reach its program whole, and hands the effect wire(argv)
only then; run.with and start.with perform the plan with an effect given
as a parameter, so a refused plan can be seen to call none. cmd is the
newline wire ez's pass effect reads.
1 import
import Base
Types
type Step source · line 52 · raw
Data
what a call does with its argv: refuse it, or hand the effect this wire
RefusedStep
Run@wire:String -> Step
Definitions
def cmd source · line 11 · raw
@argv:List<&2, String> -> String
the arguments joined on newlines, which is the wire ez's pass effect
reads. snap's own effects are handed wire and par.plan, since an
argument may hold a newline.
def line source · line 15 · raw
@argv:List<&2, String> -> String
the arguments joined on newlines; the same as cmd
def free_of source · line 19 · raw
@text:String -> @+sep:Char -> Bool
whether a string holds no copy of a char
def free_of.all source · line 28 · raw
@ps:List<&2, String> -> @+sep:Char -> Bool
whether no string of a list holds a copy of a char
def accepts source · line 39 · raw
@argv:List<&2, String> -> Bool
whether an argv can reach its program whole: it names a program, and no argument holds NUL, which separates them on the wire and which no program could be handed inside an argument anyway
def wire source · line 48 · raw
@argv:List<&2, String> -> String
the arguments as the effects want them: joined on NUL, the one char no argument can hold, so each is split back out whole
def run.plan.of source · line 57 · raw
@ok:Bool -> @argv:List<&2, String> -> Step
an argv accepted is run; any other is refused
def run.plan source · line 66 · raw
@+argv:List<&2, String> -> Step
what run, exec and start do with an argv. It decides everything: the
effect is called only with the wire of an argv this accepts.
def run.with source · line 71 · raw
@eff:(@_:String -> IO(String)) -> @step:Step -> IO(String)
a step performed by an effect that waits: a refused argv answers as a program that could not be started, and the effect is never called
def start.with source · line 80 · raw
@eff:(@_:String -> IO(String)) -> @step:Step -> IO(String)
a step performed by an effect that does not wait: a refused argv answers as a program that could not be started, and the effect is never called