Changes between Version 12 and Version 13 of Records/DeclaredOverloadedRecordFields/ImplementorsView
- Timestamp:
- 02/21/12 16:09:25 (15 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Records/DeclaredOverloadedRecordFields/ImplementorsView
v12 v13 19 19 20 20 21 === fieldLabel declaration (data dictionary) ===21 === Option One: fieldLabel declaration (data dictionary) === 22 22 23 23 There is to be a new declaration type, examples: … … 39 39 That is: the `r{ ... }` constraint is added by the desugarer (and will be further desugarred to a `Has` constraint). 40 40 41 === Option Two: explicit record constraint === 42 41 43 [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 42 57 43 58 === Syntactic sugar for `Has` ===
