升級到Ubuntu 13.10後,我的一個Haskell代碼無法編譯。下面的代碼編譯沒有下(至少)GHC-的7.0.x的問題,但在GHC-7.6.2失敗(與無序的容器-0.2.2.1):Haskell GHC-7.6.2派生數據和類型與哈希映射
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
import Data.Typeable
import Data.Data
import qualified Data.HashMap.Strict as HM
data Bar = Bar { bar :: String } deriving(Data, Typeable)
data Foo = Foo { foo :: HM.HashMap String Bar } deriving(Data, Typeable)
我得到的錯誤是:
deriving-hm-fail.hs:7:58:
No instance for (Data (HM.HashMap String Bar))
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Data (HM.HashMap String Bar))
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Data Foo)
Data.HashMap.Strict具有實例聲明:(Data k,Data v,Eq k,Hashable k)=> Data(HashMap kv)。既然Bar是數據的一個實例,這應該可行,或者我錯過了什麼?