def Spans.has
import bend-lint-rules@0.2.0.0/lib/text/main.bend as BendLintRulesimport Base
156# Whether `t` holds the span from `b` to `e`; `side` is how it compares with the root's.
157def Spans.has(t: Spans, +b: U32, +e: U32, side: Cmp) -> Bool:
158 match t side:
159 case SLeaf{} _:
160 False{}
161 case SNode{h, l, x, y, r} EQ{}:
162 True{}
163 case SNode{h, +l, x, y, r} LT{}:
164 Spans.has(l, b, e, Spans.cmp(l, b, e))
165 case SNode{h, l, x, y, +r} GT{}:
166 Spans.has(r, b, e, Spans.cmp(r, b, e))