[GHC] #15398: GADT deriving Ord generates inaccessible code in a pattern with constructor.

GHC ghc-devs at haskell.org
Mon Jul 16 16:42:52 UTC 2018


#15398: GADT deriving Ord generates inaccessible code in a pattern with
constructor.
---------------------------------+--------------------------------------
        Reporter:  philderbeast  |                Owner:  (none)
            Type:  bug           |               Status:  new
        Priority:  normal        |            Milestone:  8.6.1
       Component:  Compiler      |              Version:  8.2.2
      Resolution:                |             Keywords:
Operating System:  MacOS X       |         Architecture:  x86_64 (amd64)
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+--------------------------------------

Comment (by RyanGlScott):

 Replying to [comment:2 philderbeast]:
 > Is there no way for GHC to do the derivation without the generated code
 having warnings?

 In theory this would be possible, but it would significantly complicate
 the algorithm that `deriving Ord` uses to generate code. Currently, the
 algorithm is implemented as a pure function over the abstract syntax tree,
 but changing it to not generate inaccessible cases would require it to
 propagate typing information in a non-trivial way. I'm skeptical that such
 a large change would pay its weight, especially since the workaround (just
 use `-Wno-inaccesible-code`) is so simple.

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


More information about the ghc-tickets mailing list