Typeable instances for promoted lists and tuples
Please have a look at the following sample module:
{-# LANGUAGE DataKinds, KindSignatures, PolyKinds, AutoDeriveTypeable #-}
{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-}
import Data.Proxy
import Data.Typeable
data Foo (xs :: [*]) (p :: (*, *))
main :: IO ()
main = print (typeRep (Proxy :: Proxy (Foo '[Int] '(Bool, Char))))
-- Code above checks only with these instances, but shouldn't they
-- be predefined?
--
-- deriving instance Typeable '[]
-- deriving instance Typeable '(:)
-- deriving instance Typeable '(,)
The good news is that the code does in principle work, but as the comments say, I would have expected this to work without having to define additional instances.
(A somewhat related question is whether concrete type literals such as 3 :: Nat or "foo" :: Symbol should be instances of Typeable. They don't seem to be, and deriving does not work in these cases.)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | hvr |
| Operating system | |
| Architecture |