Changes between Version 3 and Version 4 of Records/SyntaxDirectedNameResolution
- Timestamp:
- 02/27/12 14:04:08 (16 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Records/SyntaxDirectedNameResolution
v3 v4 102 102 lenses for the fields instead of get functions. And, the # reduction will 103 103 treat an argument type of `Lens a b` specially, requiring that the type of `a` 104 being known, and looking in its module :104 being known, and looking in its module. 105 105 106 106 M.hs: … … 168 168 }}} 169 169 170 For those unfamiliar with lenses, all `deriving (Lens)` would do is: 171 172 {{{ 173 data Record = Record { a :: A, b :: B } deriving (Lens) 174 -- becomes 175 data Record = Record { a_ :: A, b_ :: B } -- or a_, b_ could be gensyms 176 a = lens a_ (\rec a -> rec { a_ = a }) 177 b = lens b_ (\rec b -> rec { b_ = b }) 178 }}} 179 180 This is the same as TH macros for existing lens libraries. 181 170 182 Note that there must be a known monomorphic type for the #a so this may require 171 183 some type declarations:
