instances for closed type families
Alan & Kim Zimmerman
alan.zimm at gmail.com
Wed May 25 17:38:30 UTC 2016
I am working on https://ghc.haskell.org/trac/ghc/ticket/12105, and have a
type to ensure that the `HsMatchContext` has either a `RdrName` or a
`Name`, not an `Id`.
type family NameOrRdrName id where
NameOrRdrName Id = Name
NameOrRdrName Name = Name
NameOrRdrName RdrName = RdrName
Is there any way to declare `Data` and `OutputableBndr` instances for this?
Without it I am having to do something like
instance (OutputableBndr name, OutputableBndr (NameOrRdrName name))
=> Outputable (HsDecl name) where
which requires UndecidableInstances.
I get
compiler/hsSyn/PlaceHolder.hs:114:19:
Illegal type synonym family application in instance:
NameOrRdrName id
In the stand-alone deriving instance for ‘Data (NameOrRdrName id)’
for the parameterised version and
compiler/hsSyn/PlaceHolder.hs:115:19:
Illegal type synonym family application in instance:
NameOrRdrName RdrName
In the stand-alone deriving instance for
‘Data (NameOrRdrName RdrName)’
for the one specific to `RdrName`.
Regards
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160525/94bf9385/attachment.html>
More information about the ghc-devs
mailing list