
#15840: Inline data constructor wrappers very late -------------------------------------+------------------------------------- Reporter: aspiwack | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.7 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 aspiwack): Here is an example program which changes behaviour depending on this ticket: {{{#!haskell data T = MkT !Bool f :: T -> Bool f _ = False {-# NOINLINE f #-} {-# RULES "non-det" [1] forall x. f (MkT x) = x #-} main :: IO () main = print (f (MkT True)) }}} Since `MkT` has a strict field, it has a wrapper. The rule triggers only if the wrapper hasn't been inlined, however, wrappers are inlined (current GHC) in phase 2, and the rules is only active in phase 1 (and later). So the rule never fires, and the program prints `False`. With the proposed patch, the wrapper is not inlined before phase 0, so the rule can fire and the program prints `False`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15840#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler