fclabels 1.1.3 → 1.1.4
raw patch · 3 files changed
+16/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Label: mkLabel :: Name -> Q [Dec]
Files
- fclabels.cabal +3/−4
- src/Data/Label.hs +2/−1
- src/Data/Label/Derive.hs +11/−3
fclabels.cabal view
@@ -1,5 +1,5 @@ Name: fclabels-Version: 1.1.3+Version: 1.1.4 Author: Sebastiaan Visser, Erik Hesselink, Chris Eidhof, Sjoerd Visscher with lots of help and feedback from others. Synopsis: First class accessor labels.@@ -20,9 +20,8 @@ . See the "Data.Label.Maybe" module for the use of partial labels. .- > 1.1.1.0 -> 1.1.2- > - Added partial set/modify versions that act as identity- > when the constructor field is not available.+ > 1.1.3 -> 1.1.4+ > - Added function to derive labels for a single datatype. Maintainer: Sebastiaan Visser <code@fvisser.nl> License: BSD3
src/Data/Label.hs view
@@ -46,7 +46,7 @@ derive lenses for these fields. Deriving lenses can be done with this simple one-liner: ->$(mkLabels [''Person, ''Place])+>mkLabels [''Person, ''Place] For all labels a lens will created. @@ -151,6 +151,7 @@ -- functions from "Data.Label.Maybe". , mkLabels+, mkLabel , mkLabelsWith , mkLabelsMono , mkLabelsNoTypes
src/Data/Label/Derive.hs view
@@ -8,6 +8,7 @@ #-} module Data.Label.Derive ( mkLabels+, mkLabel , mkLabelsWith , mkLabelsMono , mkLabelsNoTypes@@ -33,12 +34,19 @@ fclError :: String -> a fclError err = error ("Data.Label.Derive: " ++ err) --- | Derive lenses including type signatures for all the record selectors in a--- datatype. The types will be polymorphic and can be used in an arbitrary--- context.+-- | Derive lenses including type signatures for all the record selectors for a+-- collection of datatypes. The types will be polymorphic and can be used in an+-- arbitrary context. mkLabels :: [Name] -> Q [Dec] mkLabels = mkLabelsWith defaultMakeLabel++-- | Derive lenses including type signatures for all the record selectors in a+-- single datatype. The types will be polymorphic and can be used in an+-- arbitrary context.++mkLabel :: Name -> Q [Dec]+mkLabel = mkLabels . return -- | Generate the label name from the record field name. -- For instance, @drop 1 . dropWhile (/='_')@ creates a label @val@ from a