diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-04-15 04:46:21 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-04-15 04:47:04 -0700 |
commit | 928d74733975fe4677e2b558d031779f58a0883c (patch) | |
tree | 2ccbad3cabc4594c45792425ef2f01c4a535335e /compiler/deSugar/DsArrows.hs | |
parent | f4fd98c717a7f68d76a3054021b3be65d1ebad82 (diff) | |
download | haskell-928d74733975fe4677e2b558d031779f58a0883c.tar.gz |
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
Diffstat (limited to 'compiler/deSugar/DsArrows.hs')
-rw-r--r-- | compiler/deSugar/DsArrows.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/deSugar/DsArrows.hs b/compiler/deSugar/DsArrows.hs index 1738a5d8ba..ea10b7424e 100644 --- a/compiler/deSugar/DsArrows.hs +++ b/compiler/deSugar/DsArrows.hs @@ -937,7 +937,7 @@ dsRecCmd ids local_vars stmts later_ids later_rets rec_ids rec_rets = do core_rec_rets <- mapM dsExpr rec_rets let -- possibly polymorphic version of vars of later_ids and rec_ids - out_ids = varSetElems (unionVarSets (map exprFreeIds (core_later_rets ++ core_rec_rets))) + out_ids = exprsFreeIdsList (core_later_rets ++ core_rec_rets) out_ty = mkBigCoreVarTupTy out_ids later_tuple = mkBigCoreTup core_later_rets |