def walk.arms
bend-lint-pack@0.1.1.0 · complexity/cognitive.bend:40
import bend-lint-pack@0.1.1.0/complexity/cognitive.bend as Cognitive
import Base
import bend-lint-pack@0.1.1.0/vendor/lint.bend as Lint
40
41def walk.arms(cs: List<&2, Lint.Node>, +depth: U32, +first: Bool, total: U32) -> IO(U32):
42 match cs:
43 case Nil{}:
44 IO.pure(U32, total)
45 case Con{c, rest}:
46 IO.bind(
47 U32,
48 U32,
49 walk(c, Bool.pick(U32, first, U32.add(depth, 1), depth), Bool.not(first), total),
50 t2 => walk.arms(rest, depth, False{}, t2)
51 )