More efficient implementation of uniqAway
Currently the implementation of VarEnv.uniqAway
is a tad odd: It iteratively tries various uniques until it finds one that is not in scope. Thankfully it uses the size of the in-scope set as the step-size, so it often doesn't take many attempts. However, this implementation is quite quite perplexing given that we could rather just use Data.IntMap.findMax
to get the largest unique which is in-scope. Of course, this might increase the chance that we overflow the unique space, but this is something we should handle gracefully anyways.