Inline implication constraints
authorsimonpj@microsoft.com <unknown>
Mon, 5 Nov 2007 22:08:07 +0000 (22:08 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 5 Nov 2007 22:08:07 +0000 (22:08 +0000)
commit85e16365444e938b4adff9d241d56df4c1fbca91
treeeda2165ebc555da72e7608330a2d9208c8252030
parent34429d31b0d48352e4ffd29186e919b6248cdd5c
Inline implication constraints

This patch fixes Trac #1643, where Lennart found that GHC was generating
code with unnecessary dictionaries.  The reason was that we were getting
an implication constraint floated out of an INLINE (actually an instance
decl), and the implication constraint therefore wasn't inlined even
though it was used only once (but inside the INLINE).  Thus we were
getting:

ic = \d -> <stuff>
foo = _inline_me_ (...ic...)

Then 'foo' gets inlined in lots of places, but 'ic' now looks a bit
big.

But implication constraints should *always* be inlined; they are just
artefacts of the constraint simplifier.

This patch solves the problem, by adding a WpInline form to the HsWrap
type.
compiler/deSugar/DsBinds.lhs
compiler/hsSyn/HsBinds.lhs
compiler/typecheck/TcHsSyn.lhs
compiler/typecheck/TcSimplify.lhs