[GHC] #10343: Make Typeable track kind information better
GHC
ghc-devs at haskell.org
Thu Apr 23 14:43:41 UTC 2015
#10343: Make Typeable track kind information better
-------------------------------------+-------------------------------------
Reporter: oerjan | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case: typeOf ::
Related Tickets: #9858 | Typeable (a::k) => Proxy a ->
| TypeRep
| Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by oerjan):
I am not sure I can be called a client, I don't have actual useful code
hinging on this. As a hobbyist, I spend more time ''thinking'' about
Haskell than actually programming in it.
I think that simply adding `kindRep :: TypeRep -> TypeRep` as a field of
`TypeRep` would make the necessary information available at runtime. This
ought to fit just as well into the current design as into the proposed
`TTypeRep` on the wiki. I also have a hunch this might make the already
existing list of `KindRep`s redundant.
The question of how to make the `Typeable` solver make use of that
information for building kind evidence seems to me like the more
complicated part of this.
Just to prove it is possible in principle, I'll restate my mock
representation from back in [comment:48:ticket:9858]:
{{{
class (KindableParts a, a ~ Proxy) => Kindable (a :: k -> *) where
type KindableParts a :: Constraint
kindRep :: KindRep a
class Kindable (Proxy :: k -> *) => Typeable (a :: k) where
typeRep :: proxy a -> TypeRep
}}}
This worked well enough to be a basis for
[http://oerjan.nvg.org/haskell/TypeableDesign/ running my kitchen sink
test case] in 7.8.3. However, it doesn't support Richard's ideas for
avoiding exposing "`Kindable`" constraints when doing type inference. And
of course the representation's made for reusing already existing type
features rather than for efficiency.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10343#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list