ANNOUNCE: lens-family-th 0.1.0.0

Following the announcement of lens-family, I'm pleased to announce lens-family-th 0.1.0.0, a Template Haskell library supplying macros to generate lens-family lenses for fields of data types declared with record syntax. Be warned that currently, type signatures are *not* generated alongside the lens definitions. Type inference should correctly determine the type of the generated lenses, but I have structured the library code so that in the future, type signatures can also be generated. Patches welcome! http://hackage.haskell.org/package/lens-family-th -- Dan Burton

On Fri, 6 Jul 2012, Dan Burton wrote:
Following the announcement of lens-family, I'm pleased to announce lens-family-th 0.1.0.0, a Template Haskell library supplying macros to generate lens-family lenses for fields of data types declared with record syntax.
Be warned that currently, type signatures are *not* generated alongside the lens definitions. Type inference should correctly determine the type of the generated lenses, but I have structured the library code so that in the future, type signatures can also be generated. Patches welcome!
I cannot help but wonder if it is better to *not* generate type signatures (or at least have an option not to). At the moment one can write:
import Lens.Family2.Stock import Lens.Family2.TH
data Foo a = Foo { _bar :: Int, _baz :: a } deriving (Show, Read, Eq, Ord) $(mkLenses ''Foo)
-- | My documentation for the 'bar' lens. bar :: Lens (Foo a) Int
-- | My documentation for the 'baz' lens. baz :: LensFamily (Foo a) (Foo a') a a'
I don't know if it is possible to add haddock to functions whose type signatures are generated by template haskell. -- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

On Sat, 7 Jul 2012, roconnor@theorem.ca wrote:
On Fri, 6 Jul 2012, Dan Burton wrote:
Following the announcement of lens-family, I'm pleased to announce lens-family-th 0.1.0.0, a Template Haskell library supplying macros to generate lens-family lenses for fields of data types declared with record syntax.
Be warned that currently, type signatures are *not* generated alongside the lens definitions. Type inference should correctly determine the type of the generated lenses, but I have structured the library code so that in the future, type signatures can also be generated. Patches welcome!
I cannot help but wonder if it is better to *not* generate type signatures (or at least have an option not to).
In data-accessor-template we generate type signatures, also because it avoids warnings for missing type signatures. However it needed some fine-tuning before it worked in all cases.
At the moment one can write:
import Lens.Family2.Stock import Lens.Family2.TH
data Foo a = Foo { _bar :: Int, _baz :: a } deriving (Show, Read, Eq, Ord) $(mkLenses ''Foo)
-- | My documentation for the 'bar' lens. bar :: Lens (Foo a) Int
-- | My documentation for the 'baz' lens. baz :: LensFamily (Foo a) (Foo a') a a'
I don't know if it is possible to add haddock to functions whose type signatures are generated by template haskell.
Could the documentation be an argument of mkLenses?

I don't know if it is possible to add haddock to functions whose type signatures are generated by template haskell.
Could the documentation be an argument of mkLenses?
Does haddock run on the template-haskell expanded code? -- Russell O'Connor http://r6.ca/ ``All talk about `theft,''' the general counsel of the American Graphophone Company wrote, ``is the merest claptrap, for there exists no property in ideas musical, literary or artistic, except as defined by statute.''

I don't know if it is possible to add haddock to functions whose type signatures are generated by template haskell.
Could the documentation be an argument of mkLenses?
Does haddock run on the template-haskell expanded code?
TH macros must have type Q [Dec]. Dec has no constructor for comments, with the exception of pragmas. This might be feature request worthy, though it is a rather strange case to want to generate comments via a macro.

On Sat, 7 Jul 2012, Dan Burton wrote:
Could the documentation be an argument of mkLenses?
Does haddock run on the template-haskell expanded code? TH macros must have type Q [Dec]. Dec has no constructor for comments, with the exception of pragmas. This might be feature request worthy, though it is a rather strange case to want to generate comments via a macro.
Alternatively, Haddock allows you to document functions in the export list.
participants (3)
-
Dan Burton
-
Henning Thielemann
-
roconnor@theorem.ca