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

GHC ghc-devs at haskell.org
Thu Feb 5 17:11:10 UTC 2015


#9858: Typeable instances should be kind-aware
-------------------------------------+-------------------------------------
        Reporter:  dreixel           |                   Owner:  dreixel
            Type:  bug               |                  Status:  new
        Priority:  highest           |               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 int-e):

 Here is another testcase, geared towards motivating kind-level `Typeable`
 evidence (also known as `Kindable`):

 {{{
 f :: Proxy (a :: k) -> Proxy (b :: k) -> Proxy (Proxy :: k -> *)
 f _ _ = Proxy

 g pa pb = typeRep (f pa pb)
 }}}

 If we allow kind-level `Typeable` constraints, i.e., `Typeable (k ::
 BOX)`, we would have

 {{{
 g :: Typeable k => Proxy (a :: k) -> Proxy (b :: k) -> TypeRep
 }}}

 With just the type-level `Typeable`, we can choose between two
 constraints,

 {{{
 g :: Typeable (Proxy (a :: k)) => Proxy (a :: k) -> Proxy (b :: k) ->
 TypeRep
 g :: Typeable (Proxy (b :: k)) => Proxy (a :: k) -> Proxy (b :: k) ->
 TypeRep
 }}}

 so which one should type inference prefer? Or would `g` require a type
 signature?

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


More information about the ghc-tickets mailing list