Type family constraints

Simon Peyton Jones simonpj at microsoft.com
Mon Apr 23 20:04:15 UTC 2018


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 at haskell.org> On Behalf Of Alan & Kim Zimmerman
Sent: 23 April 2018 11:57
To: ghc-devs <ghc-devs at 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


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


More information about the ghc-devs mailing list