I would like to add deriving (Data)
to standard types. After enabling the StandaloneDeriving
, FlexibleContexts
, DeriveDataTypeable
, and UndecidableInstances
extensions, ghc accepts
deriving instance Data Day => Data (Day)
However, if I do the same thing for DiffTime
I get
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)'
I am doing all this to help autogenerate binary instances of standard types. So I have two questions:
- How do I solve the error I am getting with
DiffTime
, and - What is the right way to make standard library types binary serializable in Haskell?