Using:
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
And given the following datatype:
data Event a where
PureE :: a -> Event a
MapE :: (a -> b) -> Event a -> Event b
deriving instance Typeable Event
deriving instance Data a => Data (Event a)
My goal is to use the uniplate
package which requires the Data
instance.
Is GHC able to derive Typeable
and Data
automatically? Since 7.8 GHC should be able to do so and afaik at least for Typeable
it is mandatory.
I could probably write my own Data
instance ... but why do if GHC can just derive it for me?
StandaloneDeriving
, so I'm not sure what you're asking. – Hammettderiving
does not work for non Haskell98 data types. By usingb
inMapE
I left that territory. – Warga