[Haskell-cafe] ANNOUNCE: lens-family-th 0.1.0.0

roconnor at theorem.ca roconnor at theorem.ca
Sat Jul 7 11:05:45 CEST 2012


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!
> 
> http://hackage.haskell.org/package/lens-family-th

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.''



More information about the Haskell-Cafe mailing list