Kill some unnecessary varSetElems
authorBartosz Nitka <niteria@gmail.com>
Fri, 15 Apr 2016 11:46:21 +0000 (04:46 -0700)
committerBartosz Nitka <niteria@gmail.com>
Fri, 15 Apr 2016 11:47:04 +0000 (04:47 -0700)
commit928d74733975fe4677e2b558d031779f58a0883c
tree2ccbad3cabc4594c45792425ef2f01c4a535335e
parentf4fd98c717a7f68d76a3054021b3be65d1ebad82
Kill some unnecessary varSetElems

When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to
`tyCoVarsOfTypeList x`.

Why? If you look at the implementation:
```
tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty
tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty
```
they use the same helper function. The helper function returns a
deterministically ordered list and a set. The only difference
between the two is which part of the result they take. It is redundant
to take the set and then immediately convert it to a list.

This helps with determinism and we eventually want to replace the uses
of `varSetElems` with functions that don't leak the values of uniques.
This change gets rid of some instances that are easy to kill.

I chose not to annotate every place where I got rid of `varSetElems`
with a comment about non-determinism, because once we get rid of
`varSetElems` it will not be possible to do the wrong thing.

Test Plan: ./validate

Reviewers: goldfire, austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2115

GHC Trac Issues: #4012
13 files changed:
compiler/coreSyn/CoreFVs.hs
compiler/coreSyn/CoreLint.hs
compiler/deSugar/Desugar.hs
compiler/deSugar/DsArrows.hs
compiler/deSugar/DsBinds.hs
compiler/main/InteractiveEval.hs
compiler/main/TidyPgm.hs
compiler/specialise/Rules.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcSimplify.hs
compiler/typecheck/TcTyDecls.hs
compiler/typecheck/TcValidity.hs