[GHC] #15696: Derived Ord instance for enumerations with more than 8 elements seems to be incorrect

GHC ghc-devs at haskell.org
Tue Oct 2 22:52:35 UTC 2018


#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):

 I guess what I'm suggesting would be implemented most easily by replacing
 the `dataToTag#` primop a little bit.

 {{{#!hs
 unKnownType, smallType, largeType :: Int#
 unKnownType = 0#
 smallType = 1#
 largeType = 2#

 dataToTag# x = dataToTagUsing# unknownType x

 -- Takes the "strategy" to use
 dataToTagUsing# :: Int# -> a -> Int#
 }}}

 This arrangement is designed so we shouldn't have to do any painful
 restructuring of the `caseRules` or `dataToTagRule`.

 The only potential problem I see is if any user-written `RULES` match on
 `dataToTag#`, because that won't work anymore. Should we worry about that?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15696#comment:29>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list