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# from here on in a group's kids, does the fifth or sixth argument open with
96# an `Equal.cong` call? nc: the commas so far; fresh: an argument opens here;
97# seen: one did already
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

Uses (10)

Used by (1)