Changes between Version 40 and Version 41 of Records/OverloadedRecordFields/Implementation


Ignore:
Timestamp:
Aug 14, 2013 12:10:13 PM (8 months ago)
Author:
adamgundry
Comment:

deprecated fields

Legend:

Unmodified
Added
Removed
Modified
  • Records/OverloadedRecordFields/Implementation

    v40 v41  
    122122 
    123123'''AMG''' I thought this would be the `tcg_ev_binds` field of the `TcGblEnv`, but this seems to be empty by the end of `tcRnModule`. We could also look at the `inert_solved_dicts` field of `InertSet`, but I'm not sure how to propagate the required information out of the `TcS` monad to the `TcM` monad where unused names are reported. 
     124 
     125 
     126== Deprecated field names == 
     127 
     128Consider the following: 
     129 
     130{{{ 
     131module M where 
     132  {-# DEPRECATED foo "Don't use foo" #-} 
     133 
     134  data S = MkS { foo :: Int } 
     135  data T = MkT { foo :: Int } 
     136 
     137module N where 
     138  import M 
     139 
     140  data U = MkU { foo :: Int } 
     141 
     142  goo = foo (MkT 42)  
     143  bar = foo (MkU 42) 
     144  baz x = foo x 
     145}}} 
     146 
     147The `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]. 
    124148 
    125149 
     
    237261* How should dfunids/axioms and instances be propagated? 
    238262* Where should automatic instances be generated for GHCi? 
    239 * How should deprecation work for fields? Not at all? 
    240263* Document the extension, including new warnings.