簡體   English   中英

無法為關聯數據族派生Typeable

[英]Cannot derive Typeable for associated data family

我正在嘗試為相關數據系列派生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’

有人可以詳細說明這里出了什么問題嗎?

好吧,這似乎與ghc 7.8.4有關。 我嘗試使用ghc 7.10.1編譯相同的代碼片段。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM