~/bend-docscommunity

src/answer.bend checks

raw source on the hub · import 0x103d0af04de36ab98b311e537366ec67/src/answer.bend as Answer

src/answer: reading an answer, which is the exit status on its own first line, then everything the program printed.

1 import
import Base

Definitions

def code.at source · line 7 · raw

@nl:Bool -> @+ch:Char -> @rest:(@_:Unit -> String) -> String

one char of the status: a newline ends it, and any other char is part of it, with the rest of the status read only then

def code source · line 16 · raw

@out:String -> String

the exit status a run answered with: the answer up to its first newline. It reads no further, so a long body costs nothing.

def text.at source · line 25 · raw

@nl:Bool -> @+tail:String -> @rest:(@_:Unit -> String) -> String

one char before the body: a newline starts the body, which is the rest as it stands, and any other char is still the status

def text source · line 35 · raw

@out:String -> String

what the program printed, stdout and stderr together: the answer after its first newline, or nothing when it has none. The body is returned as it stands, never walked.

def ok source · line 43 · raw

@+out:String -> Bool

a run that finished with status 0