
#15696: Derived Ord instance for enumerations with more than 8 elements seems to be incorrect -------------------------------------+------------------------------------- Reporter: mrkkrp | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.6.2 Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5196 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Ah, I see what you're saying. The 0 tag is handled by the `case` wrapper (or C-- equivalent). So for small types, we don't need any extra test; we can just use the tag bits directly. I suppose also that my attempt to use tag bits for unknown types is more trouble than it's worth; we should just assume that those have too many constructors. As for the type-driven rewriting, I think we basically have two options: 1. Do it in PrelRules. I think this requires something like the `dataToTagWith#` primop I mentioned earlier. 2. Do it sometime later (tidy core, core prep, or lowering to STG). This lets us stick with `dataToTag#` throughout core2core, which is nice, but I don't know enough to know if any of those make sense or where/how to slot in the rule. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15696#comment:42 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler