[Haskell-cafe] makeFields without lenses

Brandon Allbery allbery.b at gmail.com
Sat Oct 4 13:53:26 UTC 2014


On Sat, Oct 4, 2014 at 5:57 AM, Nicola Gigante <nicola.gigante at gmail.com>
wrote:

> However, it generates lenses, which
> at this time I don’t use in my little project.
> I'll learn to use them well sooner or later,
> I promise! In the meantime, is there
> some module out there than provides a
> template haskell function that do the
> same thing but generating simple accessor
> functions instead of lenses?
>

Anything that does this creates lenses. That does not mean that they all
create Control.Lens, though; a lens is a general abstraction, not a
trademark. The simplest version, focused solely on this use case, is
probably the fclabels package.

Note that the reason they do what you need is that they are lenses. Simple
accessors will conflict as you described. fclabels is still useful if
you're only interested in lenses for record field accessors, though, since
the full lens package is rather heavyweight in that case --- and as a
bonus, you'll be getting a head start on the more general concept, without
getting dropped into the deep end of the pool.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141004/e3b04fb6/attachment.html>


More information about the Haskell-Cafe mailing list