Skip to content

cannot derive new-typeable instances for promoted data types taking parameters

Hi,

The following code shows the issue:

{-# LANGUAGE DataKinds, DeriveDataTypeable, KindSignatures, PolyKinds, StandaloneDeriving #-}
import Data.Typeable
import GHC.TypeLits

data T (a :: [*]) = T deriving (Typeable)

t = T :: T [Int, Double]

deriving instance Typeable '[]
{-

*Main> typeOf t

<interactive>:24:1:
    No instance for (Typeable (* -> [*] -> [*]) ((':) *))
      arising from a use of ‛typeOf’
    In the expression: typeOf t
    In an equation for ‛it’: it = typeOf t
-}

ghc7.7-20131004 doesn't allow either of the following:

deriving instance (Typeable a, Typeable b) => Typeable (a ': b)
-- or
deriving instance Typeable (':)

On ghc-7.6 I could write my own instance Typeable (T a), but this has been disabled it seems.

Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information