Changes between Version 12 and Version 13 of Records/OverloadedRecordFields/Implementation


Ignore:
Timestamp:
Jul 26, 2013 11:45:52 PM (2 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Implementation

    v12 v13  
    1515{{{
    1616$sel_x_T :: T -> Int       -- record selector (used to be called `x`)
     17$sel_x_T (T x) = x
     18
     19$dfHasTx :: Has T "x"      -- corresponds to the Has instance decl
     20$dfHasTx = Has $sel_x_T
    1721}}}
    1822
     
    3135
    3236'''SLPJ''' I'm very dubious about the first entry.  The `GlobalRdrEnv` is exclusively about what is lexically in scope, ie strings in your source code. `$sel_foo_T` is not such a thing.  I don't think that first entry belongs in the GRE at all.  '''End of SLPJ'''.
     37
     38'''SLPJ''' moreover I think we should store the ''dictionary'' `$dfHasTfoo` in the GRE for `foo`, not the selector.  That way we get both getter and setter (via the dictionary) in one go. 
    3339
    3440Note that the `OccName` used when adding a GRE to the environment now depends on the parent field: for `FldParent` it is the field rather than the selector name.