[GHC] #12364: Demand analysis for sum types

GHC ghc-devs at haskell.org
Mon Jul 4 15:33:42 UTC 2016


#12364: Demand analysis for sum types
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:
            Type:  task              |               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 simonpj):

 Expanding demand analysis for sums will get info for
 {{{
 f :: Maybe Int -> Int
 f Nothing = 3
 f (Just x) = x + 1
 }}}
 Currently if a call site looks like `f (Just (p+q))` we'll build a thunk
 for `p+q`.   But `f` always evaluates it, so that thunk is useless; we
 could use call-by-value.

 When we have unboxed sums, we can do worker/wrapper for `f` too.

 In contrast, you seem to be thinking about the benefits for nested CPR
 perhaps, in comment:3

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12364#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list