def array_first
qasim-bend-kit@0.1.0.2 · proof/JSON_AssemblyProof.bend:107
import qasim-bend-kit@0.1.0.2/proof/JSON_AssemblyProof.bend as JSONAssemblyProof
import Base
import qasim-bend-kit@0.1.0.2/libs/JSON.bend as J
107def array_first(+value: J.Value,
108 -tail: List<J.Token>,
109 +acc: List<&2, J.Value>,
110 +kont: J.ParserKont) -> {J.assemble(tokens(value, Whole{}, tail), J.ArrayFirst{kont}) == J.assemble(tokens(value, Whole{}, tail), J.NeedValue{J.InArray{Nil{}, kont}}) : R()}:
111 match value:
112 case J.Arr{Nil{}}: {==}
113 case J.Arr{head <> rest}: {==}
114 case J.Obj{Nil{}}: {==}
115 case J.Obj{(key, head) <> rest}: {==}
116 case J.Null{}: array_first_atom(J.decode_payload("null"), tail, kont)
117 case J.Bool{True{}}: array_first_atom(J.decode_payload("true"), tail, kont)
118 case J.Bool{False{}}: array_first_atom(J.decode_payload("false"), tail, kont)
119 case J.Number{s, cert}: array_first_atom(J.decode_payload(s), tail, kont)
120 case J.Str{s}: array_first_atom(J.decode_payload("\"" ++ J.escape_string(s) ++ "\""), tail, kont)