tyVarsOfTypeAcc

Bartosz Nitka niteria at gmail.com
Thu Dec 3 19:04:40 UTC 2015


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/FV.hs;43a31fe4c0cc0f72dfe9e0c96e1576f5cfba6e19$105-140
[2] https://github.com/niteria/deterministic-fvs/

Cheers,
Bartosz

2015-12-03 18:43 GMT+00:00 Richard Eisenberg <eir at cis.upenn.edu>:

> 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 at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151203/6316d672/attachment.html>


More information about the ghc-devs mailing list