Changes between Version 11 and Version 12 of TypeDirectedNameResolution


Ignore:
Timestamp:
Nov 19, 2009 8:53:59 AM (4 years ago)
Author:
simonpj@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeDirectedNameResolution

    v11 v12  
    197197I think this is probably worth it, although it's a little odd.  To me, the ability to "stack up" postfix operations is rather important, and the fact that it doesn't fit nicely is the biggest shortcoming of this whole proposal.  Can anyone improve it? 
    198198 
    199 == Discussion == 
     199== Discussion and other design choices == 
    200200 
    201201=== Works with any function === 
     
    286286same name. 
    287287 
    288 == Qualified import == 
     288=== Top-level disambiguation only === 
     289 
     290Consider this 
     291{{{ 
     292data R = MkR { x,y :: Int } 
     293 
     294f1 :: R -> Int -> R 
     295f1 r x = r { x = x } 
     296 
     297}}} 
     298Function `f1` is already allowed in Haskell 98; in the update `r {x=x}` the first `x` 
     299can only be a field name, while the second binds as usual to the local 
     300variable that shadows the top-level name.  This is good because it's convenient 
     301to use similar names for field names as for local variables.  Indeed GHC's support 
     302for punning makes this even more attractive. 
     303 
     304But now look at `f2`: 
     305{{{ 
     306f2 :: R -> Int 
     307f2 r x = r.x + x 
     308}}} 
     309Arguably the same story should apply.  Just as the update notation tells which is 
     310a field name, the dot notation does the same.  So perhaps in TDNR, the `r.x` should 
     311choose among '''top-level''' bindings for `x`, ignoring nested ones. 
     312 
     313=== Qualified import === 
    289314 
    290315Consider this 
     
    305330qualified or not. 
    306331 
    307 == Record syntax == 
     332NB: GHC 6.12's existing record field disambiguation makes exactly this choice already. 
     333See the [http://www.haskell.org/ghc/dist/current/docs/html/users_guide/syntax-extns.html#disambiguate-fields user manual 7.3.14].  
     334 
     335=== Record syntax === 
    308336 
    309337TDNR can apply to record construction and pattern-matching, as indeed