Deriving Typeable for poly-kinded data family gives confusing error message
The following works fine:
{-# LANGUAGE TypeFamilies, DeriveDataTypeable, StandaloneDeriving #-}
module Test where
import Data.Typeable
class Foo a where
data family Bar a
deriving instance (Typeable Bar)
However, if I add -XPolyKinds
, I get a horribly confusing error:
Test.hs:9:1:
Can't make a derived instance of ‘Typeable Bar’:
Deriving Typeable is not allowed for family instances;
derive Typeable for ‘Bar’ alone
In the stand-alone deriving instance for ‘Typeable Bar’
The correct way to resolve the error is to add a monomorphic kind signature to Bar, e.g. data family Bar (a :: *)
. Perhaps the error message could suggest this?
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |