[GHC] #12618: Add saturated constructor applications to Core
GHC
ghc-devs at haskell.org
Fri Oct 7 19:18:56 UTC 2016
#12618: Add saturated constructor applications to Core
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: nomeata
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by nomeata):
While I make progress with getting the tree to compiler properly again,
here is one question that will need to be answered.
Consider this rule:
{{{
"foldr/id" foldr (:) [] = \x -> x
}}}
Because we desugar constructor in source to the ''wrapper'' (especially if
they are unsaturated), but the wrapper is a function that will be marked
as inlineable, the compiler now gives this error message:
{{{
libraries/base/GHC/Base.hs:855:1: warning: [-Winline-rule-shadowing]
Rule "foldr/id" may never fire
because ‘GHC.Types.$W:’ might inline first
Probable fix: add an INLINE[n] or NOINLINE[n] pragma for ‘GHC.Types.$W:’
}}}
So at first I thought: Ok, no problem, I just force the inlining of data
con wrappers after the desugaring of rule left-hand sides, and this might
work for `[]`, but `(:)` is really used unsaturated here.
What is the best way forward here?
One way would be to disable this warning specifically for datacon workers,
and then make the rule matcher smart enough to match both variants.
Or alternatively, make the warning aware that an unsaturated use of a
function with an unfolding will not inline, and it is thus ok to have
something `INLINE` on the LHS of a rule, as long as it is unsaturated.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12618#comment:25>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list