
#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 simonpj): Yes, SPJ's drastic suggestion is: you polykinded type constructor cannot be an instance of `Typeable`, by `deriving`, or `AutoDeriveTypable`, or standalone deriving. Period. Here's an alternative proposal. * `....deriving( Typeable )` (and `AutoDeriveTypeable`) on a polykinded tycon will fail (with a helpful message) * But instead you can give any number of mono-kinded standalone instances {{{ deriving instance Typeable (Proxy :: (* -> *) -> *) }}} Comments on the proposal * It's still not ideal because you can never declare "enough" instances and if you declare an extra one at some use site, it might conflict with someone else's. * It requires some modification to GHC, which current rejects such standalone deriving instances, precisely because they are not fully polymorphic. * And the kinds would have to be included in the fingerprint of the `TyCon` generated by the standalone derived instance. But that seems ok as a holding position. The "right" solution is, I think, at the bottom of comment:20. But NB that solution will mean that all these standalone derived instances would become illegal, so there is a backward compatibility cost. The drastic solution does not have this problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9858#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler