Changes between Version 12 and Version 13 of Records/DeclaredOverloadedRecordFields/ImplementorsView


Ignore:
Timestamp:
Feb 22, 2012 12:09:25 AM (2 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/DeclaredOverloadedRecordFields/ImplementorsView

    v12 v13  
    1919 
    2020 
    21 === fieldLabel declaration (data dictionary) === 
     21=== Option One: fieldLabel declaration (data dictionary) === 
    2222 
    2323There is to be a new declaration type, examples: 
     
    3939That is: the `r{ ... }` constraint is added by the desugarer (and will be further desugarred to a `Has` constraint). 
    4040 
     41=== Option Two: explicit record constraint === 
     42 
    4143    [Or perhaps the new `fieldLabel` declaration isn't needed. See a ''__very__ speculative'' discussion at [wiki:Records/DeclaredOverloadedRecordFields/COmpareSORF#TheStringtypeparametertoHasandScopecontrol Wilder aftererthought] ] 
     44 
     45    Declaring: 
     46{{{ 
     47        customer_id :: r{ customer_id :: Int } => r -> Int     -- explicit record constraint 
     48                                                               -- field name same as the function name 
     49}}} 
     50    Desugars to the same as for `fieldLabel`. That is the proxy type and the binding: 
     51{{{ 
     52        data Proxy_customer_id 
     53        customer_id r = get r (undefined :: Proxy_customer_id) 
     54}}} 
     55    '''Note:''' the desugarring only applies where the field and function are the same name (and record type argument and result type). Otherwise this syntax is declaring a regular function with a record constraint (could be a 'virtual' field). 
     56 
    4257 
    4358=== Syntactic sugar for `Has` ===