
#14826: Flatten data types extending other data types in STG -------------------------------------+------------------------------------- Reporter: nomeata | Owner: (none) Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 8.5 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 nomeata): One might be able to state this in terms of unboxed sums, yes.
That way, we can drop the 'only once' requirement. Well, I guess this still involves non-id coercions...
You mean the requirement that only one `Foo` can be flattened into a `Result`? Yes, if you do this with multiple ones you either get non-id coercions (which party defeat the purpose). Or, of all types are defined in the same module, you can maybe to a smart constructor tag allocation scheme where `Foo` gets tags 1…3, `Bar` gets tags 4…6, and `data FooBar = Foo !Foo | Bar !Bar` can now be flattened simply to a pointer to a `Foo` or a `Bar` value. But let’s focus on the simple case first that does not require a global constructor pointer allocation pass :-) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14826#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler