[GHC] #9291: Don't reconstruct sum types if the type subtly changes
GHC
ghc-devs at haskell.org
Fri Jul 11 07:24:47 UTC 2014
#9291: Don't reconstruct sum types if the type subtly changes
----------------------------+----------------------------------------------
Reporter: schyler | Owner:
Type: feature | Status: new
request | Milestone:
Priority: normal | Version: 7.8.2
Component: | Keywords:
Compiler | Architecture: Unknown/Multiple
Resolution: | Difficulty: Moderate (less than a day)
Operating System: | Blocked By:
Unknown/Multiple | Related Tickets:
Type of failure: |
None/Unknown |
Test Case: |
Blocking: |
----------------------------+----------------------------------------------
Comment (by nomeata):
(Even more crazy idea: One can even take this further. What about `case x
of Right str -> Just str`. `Right` and `Just` can be used interchangeable
at runtime (same constructor number, same number of arguments of the same
shape). The compiler could create only one constructor for each such
shape, and optimize the code above to `case x of Right _ -> x`.
Furthermore we could have representational coercions between datatypes
that are α-equal... Although I doubt that the run-time benefit of that
will be high, and we’d lose all hopes to implement something like `vacuum`
or `ghc-vis`.)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9291#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list