I’m afraid I don’t understand the question.


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

 

You mean, the first group does not work, but the latter does??  I’m not even sure what “work” means.  I’m perplexed and need more context

 

Simon

 

From: ghc-devs <ghc-devs-bounces@haskell.org> On Behalf Of Alan & Kim Zimmerman
Sent: 23 April 2018 11:57
To: ghc-devs <ghc-devs@haskell.org>
Subject: Type family constraints

 

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