def own.step

yaml-for-bend@0.1.1.0 · compose.bend:232

import yaml-for-bend@0.1.1.0/compose.bend as Compose
import Base

232def own.step(r: Result<&2, &2, String, Ord>, +k: Item, v: Item) -> Result<&2, &2, String, Ord>:
233  match r:
234    case Fail{e}:
235      Fail{e}
236    case Done{+o}:
237      +key = item.val(k)
238      when(Result<&2, &2, String, Ord>, item.merge(k), u => Done{o},
239        u => when(Result<&2, &2, String, Ord>, ord.has(o, key), u => Fail{"found a duplicate key: " ++ key.text(key)},
240          u => Done{ord.put(o, key, item.val(v))}))

Uses (11)

Used by (1)