[GHC] #10835: Regression in standalone Data deriving for phantom types

GHC ghc-devs at haskell.org
Thu Sep 3 10:41:57 UTC 2015


#10835: Regression in standalone Data deriving for phantom types
-------------------------------------+-------------------------------------
        Reporter:  Feuerbach         |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by Feuerbach:

Old description:

> Thise code
>
> {{{#!hs
> {-# LANGUAGE DeriveDataTypeable, StandaloneDeriving, PolyKinds #-}
> module M where
> import Data.Data
> import Data.Typeable
>
> data Phantom t = Phantom
>   deriving Typeable
> deriving instance Typeable t => Data (Phantom t)
>
> }}}
>
> compiles with 7.8.4 but not with 7.10.2. The error is
>
> {{{
> data.hs:8:1:
>     Could not deduce (Typeable Phantom)
>       arising from the superclasses of an instance declaration
>     from the context (Typeable t)
>       bound by the instance declaration at data.hs:8:1-48
>     In the instance declaration for ‘Data (Phantom t)’
> }}}
>
> PolyKinds here is a hack I came up with to make this compile with 7.8;
> but ideally, this code should compile whether PolyKinds is enabled or
> not.

New description:

 Thise code

 {{{#!hs
 {-# LANGUAGE DeriveDataTypeable, StandaloneDeriving, PolyKinds #-}
 module M where
 import Data.Data
 import Data.Typeable

 data Phantom t = Phantom
   deriving Typeable
 deriving instance Typeable t => Data (Phantom t)

 }}}

 compiles with 7.8.4 but not with 7.10.2. The error is

 {{{
 data.hs:8:1:
     Could not deduce (Typeable Phantom)
       arising from the superclasses of an instance declaration
     from the context (Typeable t)
       bound by the instance declaration at data.hs:8:1-48
     In the instance declaration for ‘Data (Phantom t)’
 }}}

 PolyKinds here is a hack I came up with to make this compile with 7.8
 (without it, the code doesn't compile with either version); but ideally,
 this code should compile whether PolyKinds is enabled or not.

--

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


More information about the ghc-tickets mailing list