[GHC] #9701: GADTs not specialized properly
GHC
ghc-devs at haskell.org
Sat Oct 18 22:43:51 UTC 2014
#9701: GADTs not specialized properly
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.9
Resolution: | Keywords:
Operating System: | Architecture: Unknown/Multiple
Unknown/Multiple | Difficulty: Unknown
Type of failure: Runtime | Blocked By:
performance bug | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
The reason I set about this whole line of thinking was the fact that `Set`
cannot implement an efficient `Data.Foldable.elem` method. Wrapping a
`Set` in an `Ord`-carrying GADT would enable such a thing. Unfortunately,
if the GADT blocks `Ord` specialization, everything will be rather slow:
comparison operators will always be looked up in the dictionary the
wrapper points to, and there will be no opportunity for inlining, etc. My
position regarding Incoherent Instances (and DysFunctional Dependencies)
is that if your program breaks when the compiler hands you a different
dictionary than you expected, you get to keep both pieces—humans invented
nasal demons for a reason. I'm much more open to arguments against this
idea based on implementation complexity.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9701#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list