Changes between Version 30 and Version 31 of Records/DeclaredOverloadedRecordFields


Ignore:
Timestamp:
Aug 11, 2013 5:18:34 AM (2 years ago)
Author:
AntC
Comment:

rephrase from monomorphic

Legend:

Unmodified
Added
Removed
Modified
  • Records/DeclaredOverloadedRecordFields

    v30 v31  
    8181Explained in 5 wiki pages (these proposals are linked but somewhat orthogonal):
    8282
    83  * ''' [wiki:Records/DeclaredOverloadedRecordFields/NoMonoRecordFields No Mono Record Fields] '''   (precursor to DORF)
     83 * ''' [wiki:Records/DeclaredOverloadedRecordFields/NoMonoRecordFields No Record Selector Functions] '''   (precursor to DORF)
    8484 * ''' DORF -- Application Programmer's view '''     (this page)
    8585 * ''' [wiki:Records/DeclaredOverloadedRecordFields/ImplementorsView DORF -- Implementer's view] '''
     
    103103I'm not saying anything about field selection via pattern matching or record construction using explicit data constructors -- those are to behave as currently (using the approach per ‑XDisambiguateRecordFields and friends).
    104104
    105 Currently in Haskell two records in the same module can't share a field name. This is because declaring a field name within a data decl creates a monomorphic selector function; and if it's monomorphic, we can only have one. I think the wiki is characterising the problem incorrectly:
     105Currently in Haskell two records in the same module can't share a field name. This is because declaring a field name within a data decl creates a selector function bound to that record type; and if it's single-record, we can only have one. I think the wiki is characterising the problem incorrectly:
    106106
    107107 * it's __not__ that the field name appearing in different record decls is ambiguous between the two record types
     
    153153}}}
    154154 * Fields listed as `sharing` must have the `fieldLabel` declared separately (per Option One or Two).
    155  * Fields not `sharing` will get a fieldLabel declared for them,[[BR]] and it will be monomorphic (bound to a single record type).
     155 * Fields not `sharing` will get a fieldLabel declared for them,[[BR]] and it will be bound to a single record type.
    156156
    157157Or perhaps:
     
    241241=== Import/Export and Representation hiding ===
    242242
    243 [See [wiki:Records/DeclaredOverloadedRecordFields/NoMonoRecordFields No Mono Record Fields], which is implied by DORF.]
     243[See [wiki:Records/DeclaredOverloadedRecordFields/NoMonoRecordFields No Record Selector Functions], which is implied by DORF.]
    244244
    245245Since there is only a single (overloaded) field selector function created, we either have to export it always, or hide it always (that is, we can't control which record instances get exported).
     
    261261{{{
    262262{-# OPTIONS_GHC -XDeclaredOverloadedRecordFields
    263                 -XNoMonoRecordFields                   #-}
     263                -XNoRecordSelectorFunctions              #-}
    264264module M( T( x ) )       where
    265265    fieldLabel x,y :: r -> Int