[GHC] #8132: Warning for Typeable instances misplaced

GHC ghc-devs at haskell.org
Tue Aug 20 09:33:55 CEST 2013


#8132: Warning for Typeable instances misplaced
-------------------------------------------------+-------------------------
        Reporter:  scottgw                       |            Owner:
            Type:  bug                           |  dreixel
        Priority:  normal                        |           Status:  new
       Component:  Compiler                      |        Milestone:
      Resolution:                                |          Version:  7.7
Operating System:  Unknown/Multiple              |         Keywords:
 Type of failure:  Incorrect warning at          |     Architecture:
  compile-time                                   |  Unknown/Multiple
       Test Case:                                |       Difficulty:
        Blocking:                                |  Unknown
                                                 |       Blocked By:
                                                 |  Related Tickets:
-------------------------------------------------+-------------------------

Comment (by simonpj):

 It's all coming back; sorry to be so slow.  It's true that 95% of all
 users will see no change because they already say `deriving( Typeable )`.
 There are very few handwritten instances.

 It's true that changing the name of the method from `typeOf` to `typeRep`
 is an unforced change. To me `typeRep` makes more sense; `(typeOf p)`
 doesn't actually return the type of `p`, which is `Proxy t` for some t.
 But we could easily include a (deprecated) function
 {{{
 typeOf :: Typeable a => Proxy a -> TypeRep
 typeOf = typeRep
 {-# DEPRECATED typeOf "Use typeRep instead" #-}
 }}}

 Together that would mean that only a tiny fraction of uses would break;
 they can if necessary recover the old behaviour via `OldTypeable`; and
 users would have a release cycle to update to `typeRep`.

 Sound fair? It's more or less what we have in HEAD now, apart from making
 manual `Typeable` instances into errors.

 Simon

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




More information about the ghc-tickets mailing list