Changes between Version 4 and Version 5 of Records/OverloadedRecordFields/Plan


Ignore:
Timestamp:
Jun 17, 2013 4:49:06 PM (10 months ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Plan

    v4 v5  
    5555=== Representation hiding === 
    5656 
    57 Since the new constraints are '''not''' typeclass constraints, it is reasonable for the constraint solver to consult the fields in scope when deciding whether a solution is valid. This enables representation hiding: exporting the field selector is a proxy for permitting access to the field. For example, consider the following module: 
     57Since the new constraints are '''not''' typeclass constraints, it is reasonable for the constraint solver to consult the fields in scope when deciding whether a solution is valid.  
     58 
     59'''SLPJ''' As above, I'd like to say that they are just type-class constraints with special syntax.  However, maybe their instances (unlike most type-class instances) can be limited in scope; the instance is in scope iff the record field selector function is.  (Um; this sentence doesn't make so much sense if we suppress the record field selectors.) '''End of SLPJ''' 
     60 
     61This enables representation hiding: exporting the field selector is a proxy for permitting access to the field. For example, consider the following module: 
    5862 
    5963{{{ 
     
    8286means the same as `e { x = t }` except that the type is determined from the data constructor `R`, rather than the field name `x`. Thus it can be used where the latter is ambiguous. 
    8387 
     88'''SLPJ. Not the ''data'' constructor, for sure.  Possibly the type constructor.  But in any case, this is mean to be a disambiguation of 
     89{{{ 
     90  e { x = t } 
     91}}} 
     92so surely it should look like 
     93{{{ 
     94  e {T| x = t } 
     95}}} 
     96where `T` is the type constructor.   
    8497 
     98And there's a design choice here too.  Rather than special syntax we could resolve the ambiguity if you put a type signature in one of these two places: 
     99{{{ 
     100  e :: T Int { x = t } 
     101or 
     102  e { x = t } :: T Int 
     103}}} 
     104That's less invasive syntactially, and still does the job. 
     105'''End of SLPJ''' 
    85106 
    86107== Design choices ==