cons/build and making rules look boring

Simon Peyton Jones simonpj at microsoft.com
Mon Sep 1 08:48:52 UTC 2014


| 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.

Can you give a concrete, reproducible example of the problem you articulate here?  (In general, a concrete example brings tremendous focus to discussions, giving readers something specific to bite on.)

Simon

| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of David
| Feuer
| Sent: 30 August 2014 23:05
| To: ghc-devs
| Subject: cons/build and making rules look boring
| 
| 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
| properly are
| 
| 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.
| 
| David
| _______________________________________________
| ghc-devs mailing list
| ghc-devs at haskell.org
| http://www.haskell.org/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list