Changes between Version 57 and Version 58 of Records/OverloadedRecordFields/Implementation


Ignore:
Timestamp:
Aug 30, 2013 10:34:25 AM (2 years ago)
Author:
adamgundry
Comment:

deprecated fields and fixity declarations

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Implementation

    v57 v58  
    161161== Deprecated field names ==
    162162
    163 Consider the following:
    164 
    165 {{{
    166 module M where
    167   {-# DEPRECATED foo "Don't use foo" #-}
    168 
    169   data S = MkS { foo :: Int }
    170   data T = MkT { foo :: Int }
    171 
    172 module N where
    173   import M
    174 
    175   data U = MkU { foo :: Int }
    176 
    177   goo = foo (MkT 42)
    178   bar = foo (MkU 42)
    179   baz x = foo x
    180 }}}
    181 
    182 The `DEPRECATED` pragma applies to all fields `foo` exported by the module `M`, since it is based on the `OccName`. The renamer will issue a deprecation warning for every use of `foo` in `N`, regardless of whether it will later resolve to one of the fields from `M` (as in `goo`), a field definitely not in `M` (as in `bar`), or a polymorphic field (as in `baz`). It might be possible to delay the warnings to type-checking time and report deprecations more precisely, as for [#Unusedimports unused imports].
     163Deprecations and fixity declarations look for a top-level name, so they cannot be applied to overloaded record fields. Perhaps this should change. Deprecations actually work by `OccName`, so we could make
     164
     165{{{
     166{-# DEPRECATED foo "Don't use foo" #-}
     167}}}
     168
     169apply to all the `foo` fields in a module, but there are difficulties in deciding when a deprecated field has been used similar to those for [#Unusedimports unused imports].
    183170
    184171
     
    254241* Sort out reporting of unused imports.
    255242* Haddock omits fields from HTML index and prints selector names in LaTeX exports list.
    256 * What's going on with deprecations and fixity decls?
    257243
    258244* Consider syntactic sugar for `Upd` constraints.