def ord.put
import yaml-for-bend@0.1.1.0/compose.bend as Composeimport Base
import yaml-for-bend@0.1.1.0/value.bend as V
100# Puts +key+'s value: in its place when it's there, else at the end.
101def ord.put(o: Ord, +key: V.Yaml, val: V.Yaml) -> Ord:
102 match o:
103 case Ord{index, order}:
104 +c = V.canon(key)
105 ord.put.at(Map.has(&2, V.Entry, index, c), order, c, key, val)