我想添加deriving (Data)
到標準類型。使StandaloneDeriving
,FlexibleContexts
,DeriveDataTypeable
,並且UndecidableInstances
擴展後,GHC接受添加派生(數據)到標準類型
deriving instance Data Day => Data (Day)
但是,如果我爲DiffTime
做同樣的事情,我得到
TemperatureRecord.hs:30:0: The data constructors of `DiffTime' are not all in scope so you cannot derive an instance for it In the stand-alone deriving instance for `(Data DiffTime) => Data (DiffTime)'
我做的這一切,以幫助自動生成二進制標準類型的實例。所以,我有兩個問題:
- 我該怎麼解決,我與
DiffTime
得到的錯誤,並 - 是什麼力量讓標準庫類型在Haskell二進制序列化的正確方法?
如何'DiffTime'導入'TemperatureRecord'? – barkmadley 2009-12-14 04:06:46
看起來像'Data.Time.Clock' /'.Scale'不會導出'DiffTime'的構造函數'MkDiffTime'。沒有可供您使用的構造函數,標準派生方法將不起作用:/ – yairchu 2009-12-14 22:09:19
這是否意味着我骨架? – 2009-12-15 00:02:37