Type family constraints

Alan & Kim Zimmerman alan.zimm at gmail.com
Mon Apr 23 10:56:55 UTC 2018


Given

data GhcPass (c :: Pass)
deriving instance Eq (GhcPass c)
deriving instance Typeable c => Data (GhcPass c)

data Pass = Parsed | Renamed | Typechecked
         deriving (Data)

Is there any way to express that `pass` must be valid for each value of
`Pass` in the following instance head?

instance (p ~ GhcPass pass, OutputableBndrId p)
       => Outputable (HsIPBinds p) where


This comes from a problem where setting each type family instance
separately does not get picked up during instance resolution (and can't be,
according to earlier questions by me on this)

i.e.

type instance XIPBinds       (GhcPass 'Parsed) = NoExt
type instance XIPBinds       (GhcPass 'Renamed) = NoExt
type instance XIPBinds       (GhcPass 'Typechecked) = TcEvBinds

it works fine for

type instance XIPBinds       (GhcPass _) = NoExt

Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180423/20208a50/attachment.html>


More information about the ghc-devs mailing list