Changes between Version 6 and Version 7 of Records/DeclaredOverloadedRecordFields/ImplementorsView


Ignore:
Timestamp:
Feb 17, 2012 11:51:47 PM (3 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/DeclaredOverloadedRecordFields/ImplementorsView

    v6 v7  
    5151I've used a phantom/proxy type (in GHC v 7.2.1) to drive type instancing for `Has`. 
    5252 
    53 SORF uses a String Kind (which is only partially available with GHC v 7.4.1), with implicit type application (so `get` does not have a proxy argument). 
     53SORF uses a `String` Kind (which is only partially available with GHC v 7.4.1), with implicit type application (so `get` does not have a proxy argument). 
    5454I'll leave it to the implementors to determine which works best. 
    5555 
     
    9797===>  set (undefined :: Proxy_firstName) "John" myCustNA 
    9898}}} 
     99 
    99100(That is, with a name or expression preceeding the `{ ... }`. A data constructor prefix continues to use 
    100101 -XDisambiguateRecordFields.) 
     
    131132This proposal does support type changing, but at cost of considerable extra complexity. 
    132133 
    133 So the earlier definitions of Has/get/set have been "economical with the truth". Instead: 
     134So the earlier definitions of `Has/get/set` have been "economical with the truth". Instead: 
    134135{{{ 
    135136    class Has r fld t   where 
     
    144145}}} 
    145146 
    146 For monomorphic (non-changing) fields, `GetResult returns` `t` and `SetResult` returns `r`, so this amounts to the simpler definitions for Has/get/set given earlier. 
     147For monomorphic (non-changing) fields, `GetResult` returns `t` and `SetResult` returns `r`, so this amounts to the simpler definitions for `Has/get/set` given earlier. 
    147148 
    148149These are type families, not associated types, because in many cases, the result from `get` depends only on `fld`, and the result from `set` depends only on the record type `r`. In a few cases, the type function must be sensitive to the combination of field type and record type. 
    149150 
    150 The extra `Has` constraint on set's result is to 'improve' `t` by gathering constraints from the type of `set`'s resulting record type. 
    151  
    152 Note that the field value's type `t` is the type to-be in the result, _not_ the type as-was in the record being updated. 
     151The extra `Has` constraint on `set`'s result is to 'improve' `t` by gathering constraints from the type of `set`'s resulting record type. 
     152 
     153Note that the field value's type `t` is the type to-be in the result, __not__ the type as-was in the record being updated. 
    153154So the result from set has that type `inserted'. 
    154155 
     
    209210=== Representation hiding/import/export === 
    210211 
    211 See the discussion under <Application Programmer's view> and <No Mono Record Fields>. When import/exporting do we need to also export the Proxy_type? If not exported, update syntax cannot be desuggarred to use it.) 
     212See the discussion under <Application Programmer's view> and http://hackage.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/NoMonoRecordFields. When import/exporting do we need to also export the Proxy_type? If not exported, update syntax cannot be desuggarred to use it.) 
    212213 
    213214=== Should application programmers declare instances for `Has'/set? ===