def fed
bolt@1.27.0.0 · src/rules/style/transcong.bend:95
import bolt@1.27.0.0/src/rules/style/transcong.bend as Transcong
import Base
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
95
96
97
98def fed(nn: Tree.Node, +nc: Nat, +fresh: Bool, +seen: Bool) -> Bool:
99 match nn:
100 case Tree.NCons{+h, +rest}:
101 +here = Bool.and(fresh, Bool.and(late(nc), cong(Tree.NCons{h, rest})))
102 +cm = comma(h)
103 fed(rest, Nat.add(nc, Bool.pick(Nat, cm, 1n, 0n)), cm, Bool.or(seen, here))
104 case _other:
105 seen