[GHC] #12990: Partially applied constructors with unpacked fields simplified badly

GHC ghc-devs at haskell.org
Fri Dec 16 01:54:42 UTC 2016


#12990: Partially applied constructors with unpacked fields simplified badly
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Actually, I guess the eta-expansion per se is always safe (because a
 strict constructor can never have a weird arity), and will lead to case-
 of-known-constructor when relevant. I don't have any opinion whatsoever
 about exactly ''how'' this should be fixed; I just want it fixed. I've had
 to write some unpleasantly long-winded code in `containers` to work around
 this. It shows up all over `Traversable` things, for instance.

 {{{#!hs
 data Node = Node2 !Int a a | Node3 !Int a a a
 instance Traversable Node where
   traverse f (Node2 sz x y) =
     Node2 sz <$> traverse f x <*> traverse f y
   ...
 }}}

 is no good; GHC would box up the node size (which starts out unboxed!)
 just to put it in the closure passed to `fmap`.

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


More information about the ghc-tickets mailing list