[GHC] #9858: Typeable instances should be kind-aware
GHC
ghc-devs at haskell.org
Wed Jan 28 21:37:05 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):
Replying to [comment:33 oerjan]:
> But anyway, here it is, sort of working, but with some obvious
drawbacks:
One such drawback is that the `Kindable'` constraint is sort of
infectious. One can using a type family for mapping kinds to types, which
seems to overcome that particular shortcoming:
{{{
type family KindRep (p :: k)
data Star deriving Typeable
type instance KindRep (Proxy :: * -> *) = Star
type instance KindRep (Proxy :: (k -> k') -> *) = KindRep (Proxy :: k ->
*) -> KindRep (Proxy :: k' -> *)
-- some data kinds: () and []
type instance KindRep (Proxy :: () -> *) = ()
type instance KindRep (Proxy :: [k] -> *) = [KindRep (Proxy :: k -> *)]
}}}
One could then have
{{{
instance Typeable (KindRep (Proxy :: k -> *)) => Typeable' (Proxy :: k ->
*)
}}}
Here's some working code: http://lpaste.net/4263409010180358144
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9858#comment:34>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list