[GHC] #9858: Typeable instance for datatype and its promoted constructor is the same

GHC ghc-devs at haskell.org
Sat Jan 17 09:31:01 UTC 2015


#9858: Typeable instance for datatype and its promoted constructor is the same
-------------------------------------+-------------------------------------
        Reporter:  dreixel           |                   Owner:  dreixel
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.10.1
       Component:  Compiler          |                 Version:  7.9
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by dreixel):

 Replying to [comment:9 oerjan]:
 > Replying to [comment:7 dreixel]:
 > > Replying to [comment:5 int-e]:
 > > > One way of fixing this would be to prepend a prime (or some other
 non-capital letter character) to {{{name_fs}}} in
 {{{TcGenDeriv.gen_Typeable_binds}}} if the given {{{tycon::TyCon}}} is a
 promoted data constructur.
 > > >
 > > > Is this sufficient (...)
 > >
 > > I believe so. It should be a really simple fix.
 >
 > Nope, here is a version based simply on using different promoted kinds
 (that are not visible in the Typeable instance).  Also works to modify
 Shachaf's unsafeCoerce from #10000.
 >
 > {{{
 > {-# LANGUAGE DataKinds              #-}
 > {-# LANGUAGE AutoDeriveTypeable     #-}
 >
 > import Data.Typeable
 >
 > data A t = A
 >
 > main = print $ typeRep (Proxy :: Proxy (A :: Bool -> *))
 >                == typeRep (Proxy :: Proxy (A :: Ordering -> *))
 >
 > }}}

 I think this example highlights a different limitation of Typeable, along
 the lines of #7897.

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


More information about the ghc-tickets mailing list