[GHC] #8177: Roles for type families

GHC ghc-devs at haskell.org
Tue Aug 27 16:41:20 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 goldfire):

 I'm not convinced that this is useless, actually. For example, I don't
 think Simon's last example `F` could be written without role annotations
 on type families, even if we switch the order of parameters. And, the kind
 signature trick doesn't work at all with data families:

 {{{
 data family Q1 :: * -> *
 }}}
 is equivalent to
 {{{
 data family Q2 a
 }}}

 In particular, under the current implementation, instances of `Q1` ''can''
 pattern-match on the parameter. Accordingly, `Q1`'s parameter is currently
 given role N, just like `Q2`'s.

 So, I do think this idea would yield a real expressiveness gain, and I
 mused about it while implementing the main chunk of roles. Is it worth the
 extra complexity? Perhaps.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8177#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list