def fold

bend-toon-codec@0.1.0.0 · src/decode.bend:23

import bend-toon-codec@0.1.0.0/src/decode.bend as Decode
import Base
import bend-toon-codec@0.1.0.0/src/dline.bend as D
import bend-toon-codec@0.1.0.0/src/frame.bend as F
import bend-toon-codec@0.1.0.0/src/step.bend as T

23# Apply every line in order, stopping at the first error.
24def fold(+ls: List<&2, D.DL>, +sr: Result<&2, &2, String, F.St>, +strict: Bool) -> Result<&2, &2, String, F.St>:
25  match ls sr:
26    case Nil{} _:
27      sr
28    case Con{l, t} Done{st}:
29      fold(t, T.step(l, st, strict), strict)
30    case Con{l, t} Fail{e}:
31      Fail{e}

Uses (7)

Used by (2)