def co.push

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

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

478# A collection opens, unless collections already nest as deep as allowed.
479def co.push(co: Co, o: Open, +limit: Nat, at: T.Mark) -> Result<&2, &2, T.Error, Co>:
480  match co:
481    case Co{stack, anchors, count, root, docs, opened, +depth, copied}:
482      when(Result<&2, &2, T.Error, Co>, Nat.is_ge(depth, limit), u => Fail{limit.error("found nesting deeper than the depth limit of " ++ Nat.show(limit), at)},
483        u => Done{Co{o <> stack, anchors, count, root, docs, opened, 1n+depth, copied}})

Uses (12)

Used by (1)