[GHC] #8177: Roles for type families
GHC
ghc-devs at haskell.org
Tue Aug 27 13:32:29 UTC 2013
#8177: Roles for type families
-------------------------------------+------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by simonpj):
Harump. You are right. `type` families are the very source of pattern
matching so ''of course'' `type` families should have argument of role N.
You could argue that there might be a parameter of the family that is
never matched. Thus:
{{{
type family F a at R b at N
type instance F a Int = a -> a
type instance F a Bool = (a,a)
}}}
But it's a bit marginal; in most cases you could re-order the args
{{{
type family F b at N :: * -> *
}}}
and similarly for the instances.
I think it's the same for `data` families. For example, it'd be utterly
wrong to make a newtype coercion between `(D Age)` and `(D Int)`; so `D`'s
parameter must clearly be role N.
In short, the main merit of this ticket would be to allow ''parametric''
(non-indexed) parameters to appear before ''index'' parameters. That
seems a fairly marginal gain.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8177#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list