我想添加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