I have a GADT that is used with only two different parameters: ForwardPossible and ():
-- | Used when a forward definition is possible. data ForwardPossible = ForwardPossible deriving (Eq, Ord, Typeable, Data, Show) -- | GADT which accepts forward definitions if parameter is ForwardPossible. data OrForward t forward where OFKnown :: t -> OrForward t forward OFForward :: NamespaceID -> SrcSpan -> BS.ByteString -> OrForward t ForwardPossible deriving instance Eq t => Eq (OrForward t forward) deriving instance Ord t => Ord (OrForward t forward) deriving instance Typeable2 OrForward deriving instance Show t => Show (OrForward t forward)
I would like to get enough Data.Data instances to cover both OrForward t () and OrForward t ForwardPossible. I do not think that a common (Data t, Data forward) => Orforward t forward instance is possible if it does not ignore OFFORward at all, but either overlaps the instances for Data t => OrForward t ForwardPossible and (Data t, Data forward) = > Direct OrForward instances may be the solution if there is a way to make ghc to get those instances.
I tried to determine:
deriving instance Data t => Data (OrForward t ()) deriving instance Data t => Data (OrForward t ForwardPossible)
but then ghc gives me this error:
Duplicate type signature: Structure.hs:53:1-70: $tOrForward :: DataType Structure.hs:52:1-49: $tOrForward :: DataType
a1kmm source share