Safe Haskell | None |
---|
Documentation
mkLabels :: [Name] -> Q [Dec]Source
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.
mkLabel :: Name -> Q [Dec]Source
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.
mkLabelsWith :: (String -> String) -> [Name] -> Q [Dec]Source
Generate the label name from the record field name.
For instance, drop 1 . dropWhile (/='_')
creates a label val
from a
record Rec { rec_val :: X }
.
mkLabelsMono :: [Name] -> Q [Dec]Source
Derive lenses including type signatures for all the record selectors in a datatype. The signatures will be concrete and can only be used in the appropriate context.
mkLabelsNoTypes :: [Name] -> Q [Dec]Source
Derive lenses without type signatures for all the record selectors in a datatype.
defaultMakeLabel :: String -> StringSource
Generate a name for the label. If the original selector starts with an
underscore, remove it and make the next character lowercase. Otherwise,
add l
, and make the next character uppercase.