Changes between Version 3 and Version 4 of Records/SyntaxDirectedNameResolution


Ignore:
Timestamp:
Feb 27, 2012 10:04:08 PM (2 years ago)
Author:
elaforge
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/SyntaxDirectedNameResolution

    v3 v4  
    102102lenses for the fields instead of get functions.  And, the # reduction will 
    103103treat an argument type of `Lens a b` specially, requiring that the type of `a` 
    104 being known, and looking in its module: 
     104being known, and looking in its module. 
    105105 
    106106M.hs: 
     
    168168}}} 
    169169 
     170For those unfamiliar with lenses, all `deriving (Lens)` would do is: 
     171 
     172{{{ 
     173data Record = Record { a :: A, b :: B } deriving (Lens) 
     174-- becomes 
     175data Record = Record { a_ :: A, b_ :: B } -- or a_, b_ could be gensyms 
     176a = lens a_ (\rec a -> rec { a_ = a }) 
     177b = lens b_ (\rec b -> rec { b_ = b }) 
     178}}} 
     179 
     180This is the same as TH macros for existing lens libraries. 
     181 
    170182Note that there must be a known monomorphic type for the #a so this may require 
    171183some type declarations: