def is_before
import bend-lint-rules@0.2.0.0/layout/imports.bend as Importsimport Base
178# Whether `a` may come before `b`: Base first, then by path, then by alias.
179def is_before(a: Entry, b: Entry) -> Bool:
180 match a b:
181 case Entry{i, True{}, p, x, l, t} _:
182 True{}
183 case Entry{i, False{}, p, x, l, t} Entry{j, True{}, q, y, m, u}:
184 False{}
185 case Entry{i, False{}, +p, x, l, t} Entry{j, False{}, +q, y, m, u}:
186 Bool.pick(Bool, String.eq(p, q), String.is_le(x, y), String.is_lt(p, q))