DanBurton / lens-family-th

Template Haskell to generate lenses for lens-family and lens-family-core
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

Use same convention for Stock lenses and default lens derivations #4

Closed DanBurton closed 12 years ago

DanBurton commented 12 years ago

Lens.Family[2].Stock lenses use the convention of fooL, while Lens.Family.TH will create fooLens for a record field named foo. While I believe underscore-prefixed fields should retain the same behavior, it would be wise to cause the other behavior to agree with Stock, whether that be changing Stock lenses to spell out the full word, or change generated lenses to not.

DanBurton commented 12 years ago

I've "fixed" this by removing the default fallback of (++ "Lens"). Now, the default is to create lenses for underscore-prefixed fields only. The "example usage" of mkLensesBy now demonstrates how to generate lenses for all fields by appending "L":

$(mkLensesBy (\n -> Just (n ++ "L")) ''Foo)