[GHC] #8185: Change role annotation syntax

GHC ghc-devs at haskell.org
Tue Aug 27 20:29:47 UTC 2013


#8185: Change role annotation syntax
----------------------------------------------+----------------------------
       Reporter:  goldfire                    |             Owner:
           Type:  feature request             |  goldfire
       Priority:  normal                      |            Status:  new
      Component:  Compiler                    |         Milestone:  7.8.1
       Keywords:                              |           Version:  7.7
   Architecture:  Unknown/Multiple            |  Operating System:
     Difficulty:  Moderate (less than a day)  |  Unknown/Multiple
     Blocked By:                              |   Type of failure:
Related Tickets:                              |  None/Unknown
                                              |         Test Case:
                                              |          Blocking:
----------------------------------------------+----------------------------
 Currently, role annotations look like this:

 {{{
 data Foo a at N = ...
 }}}

 I've received several criticisms of this syntax:

 * It is not backward compatible. If a library wishes to use role
 annotations and remain compilable with earlier versions of GHC,
 preprocessor commands are necessary.
 * It is inscrutable for someone not well-versed in roles.
 * It reminds people of as-patterns, which it is unrelated to.
 * It is conceivable that it would conflict with type-level as-patterns.

 For these reasons, I propose the following:

 {{{
 data Foo a {-# ROLE Nominal #-} = ...
 }}}

 This syntax, while verbose, eliminates these concerns, considering that
 the new syntax is easily searchable for someone who doesn't know it. I
 have proposed something similar on ghc-devs, with no response, so I will
 implement it shortly.

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




More information about the ghc-tickets mailing list