def is_flat
import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFitimport Base
127# Whether the types of `todo` are numbers, or records of numbers. `fuel` bounds the steps, so a
128# recursive type, which never ends, is data.
129def is_flat(fuel: Nat, todo: Maybe<&2, List<&2, String>>, +slots: List<&2, Slot>) -> Bool:
130 match fuel todo:
131 case _ None{}:
132 False{}
133 case _ Some{Nil{}}:
134 True{}
135 case 0n _:
136 False{}
137 case 1n+f Some{Con{+t, rest}}:
138 is_flat(f, is_flat.next(is_scalar(t), t, rest, slots), slots)