[GHC] #10347: Spurious "unused constructor" warning with Coercible

GHC ghc-devs at haskell.org
Sat Sep 8 20:11:49 UTC 2018


#10347: Spurious "unused constructor" warning with Coercible
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Incorrect         |            Test Case:
  warning at compile-time            |  typecheck/should_compile/T10347
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I ran into this issue in real code yesterday. We can now write

 {{{#!hs
 class (forall a b. Coercible a b => Coercible (f a) (f b)) =>
 Representational f
 instance (forall a b. Coercible a b => Coercible (f a) (f b)) =>
 Representational f
 }}}

 But to sort of simulate that in older versions, I used

 {{{#!hs
 data Skolem
 newtype Skolem' = Skolem' Skolem
 class Representational f
 instance (Coercible (f Skolem) (f Skolem'))
   => Representational f
 }}}

 GHC complained because the `Skolem'` data constructor isn't used directly.

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


More information about the ghc-tickets mailing list