Search code examples
haskelltype-familiesderived-instances

Cannot derive Typeable for associated data family


I'm trying to derive Typeable for an associated data family like so:

{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TypeFamilies #-}
module Test where

import Data.Typeable

class Test a where
  data DTest a :: *

instance Test () where
  data DTest () = Foo
    deriving Typeable

But I'm getting the following error message and it leaves me a little puzzled:

[1 of 1] Compiling Test             ( test.hs, test.o )

test.hs:12:14:
    Cannot eta-reduce to an instance of form
      instance (...) => Typeable DTest
    In the data instance declaration for ‘DTest’

Could someone please elaborate as to what is going wrong here?


Solution

  • Ok, this seems to be related to ghc 7.8.4. I tried the same code snippet with ghc 7.10.1 and it compiled.