3

我正在尝试Typeable为这样的关联数据系列派生:

{-# 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

但是我收到以下错误消息,这让我有点困惑:

[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’

有人可以详细说明这里出了什么问题吗?

4

1 回答 1

2

好的,这似乎与ghc7.8.4有关。ghc我用7.10.1尝试了相同的代码片段 并编译了它。

于 2015-05-01T20:43:13.843 回答