#2104: Add Labels
--------------------------------+-------------------------------------------
    Reporter:  barney           |       Owner:          
        Type:  feature request  |      Status:  new     
    Priority:  normal           |   Component:  Compiler
     Version:  6.8.2            |    Severity:  normal  
    Keywords:                   |    Testcase:          
Architecture:  Unknown          |          Os:  Unknown 
--------------------------------+-------------------------------------------
 This is an alternative to #1894 to support the implementation of
 ExtensibleRecords. This version is more complex, but both more orthogonal
 to the rest of the language, and supports better record features.

 1. Add a new syntactic class[[BR]]
     label -> ( {{{'}}} (small | large | digit) {small | large | digit |
 {{{'}}} }),,<char>,,

 A label {{{'name}}} is interpreted as a conid at the value level, and as a
 tycon at the type level, with an implicit declaration:
 {{{
 data 'name = 'name
 }}}
 but with global scope, so the same label in different modules is the same
 value/type.

 2. Add a built-in one-parameter type class {{{Label}}} with no methods,
 and for each label {{{'name}}} an implicit instance
 {{{
 instance Label 'name where
 }}}
 No other instances of {{{Label}}} are allowed.

 3. Add a built-in type synonym family {{{LabelCMP}}} of kind {{{* -> * ->
 *}}}. For every pair of labels {{{'name1}}} and {{{'name2}}}, one of the
 instances
 {{{
     LabelCMP 'name1 'name2 = LabelLT
     LabelCMP 'name1 'name2 = LabelEQ
     LabelCMP 'name1 'name2 = LabelGT
 }}}
 is implicitly defined, depending on the lexicographic order of
 {{{'name1}}} and {{{'name2}}}. No other instances of {{{LabelCMP}}} are
 allowed. (The types {{{LabelLT}}}, {{{LabelEQ}}} and {{{LabelGT}}} are
 datatypes with no constructors, which can be declared in a library.)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2104>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to