
#13861: Take more advantage of STG representation invariance (follows up #9291) -------------------------------------+------------------------------------- Reporter: heisenbug | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 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): Things to think about * It's not just memory layout. To substitute one data constructor for another, they must have the same ''tag''; and may even need to belong to a data type with the same number of data constructors. Eg {{{ case x of Nothing -> True }}} `Nothing` has tag zero, and `True` has tag 1. * Runtime debugging or heap analysis may display the data constructor. Substituting a data constructor from another type would break this utterly. I'd need a bit of convincing that the benefit (in performance) justified the cost; and that the opportunities to exploit this happen often enough to use worth doing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13861#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler