Skip to content
  • niteria's avatar
    Kill some unnecessary varSetElems · 928d7473
    niteria authored
    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
    928d7473