Avoid allocating intermediate lists for non recursive bindings.
Something like mkVarSet $ bindersOf b
ends up allocating a list if b
is a non-recursive binder currently.
I tried addressing this by essentially providing foldBindersOf
and using foldBindersOf extendVarSet emptyVarSet b
instead which folds over the binder without allocating an intermediate list. Not sure if it's worth it though.
The fold ends up not getting inlined which makes extendVarSet
a unknown call which also isn't great. We could special case that but not sure it's worth it.
Putting this up so CI might provide some insight.