[Haskell-cafe] Unused type-classes triggering a recompilation?
allbery.b at gmail.com
Wed Oct 18 17:31:40 UTC 2017
On Wed, Oct 18, 2017 at 1:23 PM, Saurabh Nanda <saurabhnanda at gmail.com>
> We're trying to optimise the way lenses are built and imported in our
> project (there are 500+ of them!) . In the simplified version that I have
> presented below, whenever a new HasX class is added to the LensClasses
> module, both User & Main end up getting recompiled even though they have
> nothing to do with the newly added type-class. I've read and re-read
> "Recompilation Avoidance" , but haven't been able to figure out why this
> would be happening.
Because it is part of the external interface for dependencies of those
modules and therefore triggers both an API change (which here has no
effect) and an ABI change because internals of a module can leak out via
.hi file exposure for cross-module inlining. There is no way to guard
against that last, and avoiding it would usually be even more expensive
than just treating the entire .hi as a dependency that changed (the
dependency graph would *explode* if you had to track dependencies per
And no, you do not want to defeat inlining, *especially* with lens.
Performance will utterly tank.
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe