
#8185: Change role annotation syntax ----------------------------+---------------------------------------------- Reporter: | Owner: goldfire goldfire | Status: new Type: feature | Milestone: 7.8.1 request | Version: 7.7 Priority: normal | Keywords: Component: | Architecture: Unknown/Multiple Compiler | Difficulty: Moderate (less than a day) Resolution: | Blocked By: Operating System: | Related Tickets: Unknown/Multiple | Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Comment (by goldfire): Role annotations can appear for one of two reasons: * The writer of some datatype wishes to restrict its use and prevent `GeneralizedNewtypeDeriving` over classes that use that datatype. This type of role annotation can make only '''fewer''' programs type-check. Thus, it is '''never''' necessary, thus conforming to Simon's dictum about pragmas always being optional. * Types declared in hs-boot files must match the types in the base hs files. If the body of the type of omitted, a role annotation is sometimes necessary to make things match up. (Roles in hs-boot files default to Representational, which is the common case. This defaulting mechanism is documented in the hs-boot section of the manual.) This type of annotation is sometimes necessary, so it violates Simon's dictum. Given the second use of role annotations above, we may want to consider a non-pragma syntax, in order to keep pragmas as optional. (Though, it's worth noting that `LANGUAGE` pragmas are surely ''not'' optional.) I favor including the word "role" in the notation (for easy searching of an esoteric topic). I would also prefer using `{ }` over `[ ]` in a notation like Simon's suggestion -- braces are never used like that, and it avoids the appearance of talking about lists. I do have to say I'm not totally convinced that using a pragma is a bad idea. Not only are `LANGUAGE` pragmas required, but also `SOURCE` pragmas. Other thoughts? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8185#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler