
Hi devs, I'm (once again) merging master into my type=kind branch. I see that we now have tyVarsOfTypeAcc :: Type -> FV, distinct from tyVarsOfType :: Type -> TyVarSet. I trust that this new version is more performant. However, I have a question: in the implementation of these functions, the three extra FV parameters (fv_cand in_scope acc) are bound and passed each time. Why? I've always understood that eta-reducing in function definitions is better than expanding. Or is this just a style choice? Thanks, Richard

Bartosz left a note in the diff about it being faster this way:
https://github.com/niteria/deterministic-fvs/blob/master/results.txt#L83-L89
But yeah, I would have also thought it better eta-reduced.
On Thu, Dec 3, 2015 at 10:43 AM, Richard Eisenberg
Hi devs,
I'm (once again) merging master into my type=kind branch. I see that we now have tyVarsOfTypeAcc :: Type -> FV, distinct from tyVarsOfType :: Type -> TyVarSet. I trust that this new version is more performant. However, I have a question: in the implementation of these functions, the three extra FV parameters (fv_cand in_scope acc) are bound and passed each time.
Why?
I've always understood that eta-reducing in function definitions is better than expanding. Or is this just a style choice?
Thanks, Richard _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Hi Richard,
I've introduced tyVarsOfTypeAcc recently and the main reason was to get
deterministic order (part of #4012) of free variables in places that
require it, like abstracting type variables when floating out expressions.
It does a bit more than tyVarsOfType, but it's algorithmically better (it
avoids set union) and in the end it comes out about equal in terms of
performance on GHC tests.
The reason for eta-expanding is performance, and I wrote a note [1] about
it.
I've also run some isolated benchmarks [2] if you're interested.
[1]
https://phabricator.haskell.org/diffusion/GHC/browse/master/compiler/utils/F...
[2] https://github.com/niteria/deterministic-fvs/
Cheers,
Bartosz
2015-12-03 18:43 GMT+00:00 Richard Eisenberg
Hi devs,
I'm (once again) merging master into my type=kind branch. I see that we now have tyVarsOfTypeAcc :: Type -> FV, distinct from tyVarsOfType :: Type -> TyVarSet. I trust that this new version is more performant. However, I have a question: in the implementation of these functions, the three extra FV parameters (fv_cand in_scope acc) are bound and passed each time.
Why?
I've always understood that eta-reducing in function definitions is better than expanding. Or is this just a style choice?
Thanks, Richard _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (3)
-
Andrew Farmer
-
Bartosz Nitka
-
Richard Eisenberg