def cell

bend-toon-codec@0.1.0.0 · src/expand.bend:95

import bend-toon-codec@0.1.0.0/src/expand.bend as Expand
import Base
import bend-toon-codec@0.1.0.0/src/json.bend as J

95# A cell of a field chain: replace the value when the key is the path's head,
96# else look further along the chain.
97def cell(+hit: Bool, +k: String, +ev: J.Json, +t: J.Json, +rv: Result<&2, &2, String, J.Json>, +rt: Result<&2, &2, String, J.Json>) -> Result<&2, &2, String, J.Json>:
98  match hit rv rt:
99    case True{} Done{v} _:
100      Done{J.JField{k, v, t}}
101    case True{} Fail{e} _:
102      Fail{e}
103    case False{} _ Done{t2}:
104      Done{J.JField{k, ev, t2}}
105    case False{} _ Fail{e}:
106      Fail{e}

Uses (4)

Used by (1)