【问题标题】:Cannot derive Typeable for associated data family无法为关联的数据族派生 Typeable
【发布时间】:2015-05-01 20:39:31
【问题描述】:

我正在尝试为关联的数据系列派生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’

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

【问题讨论】:

    标签: haskell type-families derived-instances


    【解决方案1】:

    好的,这似乎与ghc 7.8.4 有关。我尝试了相同的代码 sn-p ghc 7.10.1 并已编译。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-22
      • 2013-08-31
      • 1970-01-01
      • 1970-01-01
      • 2019-02-21
      • 2013-04-29
      • 2020-09-08
      • 1970-01-01
      相关资源
      最近更新 更多