cons/build and making rules look boring
david.feuer at gmail.com
Sat Aug 30 22:05:15 UTC 2014
I think I may have figured out at least part of the reason that
cons/build gives bad results. I actually ran into a clue when working
on scanl. It seems at least part of the problem is that a rule like
x : build g = build (\c n -> c x (g c n))
makes (:) look "interesting" to the inliner. Unfortunately, as I
discovered after much extreme puzzlement about why rules relating to
scanl were affecting things that had nothing to do with scanl, it
turns out that making (:) look interesting is really quite bad, and
something that we probably never want to happen.
As a result, the only ways I see to try to make rules like that work
1. If constructors are *always* best treated as boring, and the
inliner knows when's a constructor, make it treat them all as boring.
2. Offer a BORINGRULE annotation to indicate that the rule should not
make its LHS "interesting", or
3. (I don't like this option much) Make a special case forcing (:) in
particular to be boring.
More information about the ghc-devs