Lens 4.4 release notes
There's a new release of the lens package tonight, and I'd like to break down some of the changes from the changelog.
http://hackage.haskell.org/package/lens
Template Haskell changes
The Template Haskell module has been around through many revisions of the lens package and seen a lot of features added to it. There were multiple implementations of the same functionality in the module doing slightly different things and it was becoming a challenge to fix bugs or add functionality. To improve this situation the TH code has been rewritten and unified.
-
The common cases of
makeLensesandmakePrismsshould continue to work as before. -
There's a new
makeClassyPrismsfunction to complement themakeClassylens generating code. You can read more about this feature in the haddocks! -
Lenses generated for a single constructor now use irrefutable patterns. This allows you to initialize an
undefinedwith lenses. -
The
makeFieldsimplementation is now merged into themakeLensesimplementation. If you were previously usingmakeFieldsWithin order to provide a custom rule set, you should migrate to usingmakeLensesWith -
Note:
makeIsoswas removed in the 4.3 release. BothmakeLensesandmakePrismswill generate anIsowhen possible.
Data.Aeson.Lens split
The Data.Aeson.Lens module has been migrated back into its own package. This change will enable this module to continue to evolve its API beyond what we usually provide in the lens package and it reduces our direct package dependencies by three (aeson, scientific, attoparsec). This will also help to reduce build times, which can be particularly important to sandbox users.
http://hackage.haskell.org/package/lens-aeson
Miscellaneous
Reviewis now a proper supertype ofPrismmakeLensesunifies field types for lenses/traversals spanning different field types.GHC.Generics.Lens.tinplateworks correctly on data types with both a single constructor and single field as well as empty data types.
Report your issues
Please report your issues to the GitHub issue tracker. While we'll be reading comments on Reddit, it will help to ensure our issue isn't lost.
Posted Aug 22, 2014, 6:41 AM UTC
Nice work guys! Especially happy to hear about
makeClassyPrisms- I wrote those classes out by hand only a few weeks ago, and here you are already automating that work out of my hands. Can't complain :)