[GHC] #9858: Typeable instances should be kind-aware

GHC ghc-devs at haskell.org
Wed Apr 15 06:20:05 UTC 2015


#9858: Typeable instances should be kind-aware
-------------------------------------+-------------------------------------
        Reporter:  dreixel           |                   Owner:
            Type:  bug               |                  Status:  merge
        Priority:  highest           |               Milestone:  7.10.2
       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:                    |  typecheck/should_fail/T9858a,
                                     |  should_run/T9858b
                                     |                Blocking:
                                     |  Differential Revisions:  Phab:D652
-------------------------------------+-------------------------------------

Comment (by oerjan):

 Although Edward's suggestion is elegant, I am thinking that separating
 `Typeable (() :: Constraint)` and `Typeable (() :: *)`, in the same way as
 promoted constructors have been separated from identically named
 datatypes, is all that is needed to stop this bug without outlawing
 Typeable constraints.

 I think it is impossible to construct two types of the same kind with
 identical `TypeRep`s without using the kind ambiguity of `()`.

 Although intuitively, `Typeable` for tuple constructors and `->` vs. `=>`
 should also be separated, just in case.  But the former only pass *on*
 kind ambiguity, while the latter *merge* it.  Only `()` can create it in
 such a way that it can be merged back (by `->`/`=>`) later.

 Which means `->`/`=>` is also necessary, I guess, so if you wanted to
 outlaw the most impredicative `Typeable`s, you could outlaw just
 "`Typeable ((=>) ...)`" instead.

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


More information about the ghc-tickets mailing list