
#10343: Make Typeable track kind information better -------------------------------------+------------------------------------- Reporter: oerjan | Owner: goldfire Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: typeOf :: | Typeable (a::k) => Proxy a -> | TypeRep Blocked By: | Blocking: Related Tickets: #9858 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): My goal was to augment the existing `Typeable` interface with a means of extracting the kind of the type represented by a given `TypeRep`. That is, {{{#!hs -- The current (non-type-indexed) TypeRep machinery data TypeRep type KindRep = TypeRep typeRep :: Typeable a => Proxy a -> TypeRep -- I wanted this... typeRepKind :: TypeRep -> KindRep }}} As far as I can tell, the semantics of `typeRepKind` should be clear so long as we are only talking about monomorphically kinded types. For instance, {{{#!hs kindRep :: Typeable a => Proxy a -> KindRep kindRep = typeRepKind . typeRep kindRep (Proxy :: Proxy Int) == * kindRep (Proxy :: Proxy Int#) == TYPE 'Unlifted kindRep (Proxy :: Proxy '[4]) == '[Nat] kindRep (Proxy :: Proxy (4 ':)) == '[Nat] -> '[Nat] kindRep (Proxy :: Proxy []) == * -> * kindRep (Proxy :: Proxy [Int]) == * kindRep (Proxy :: Proxy ((->) Int)) == * -> * kindRep (Proxy :: Proxy Eq) == * -> Constraint kindRep (Proxy :: Proxy (':)) insoluble kindRep (Proxy :: Proxy 'Just) insoluble }}} I have not thought much about this might fit in to the new type-indexed `TypeRep`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10343#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler