[Haskell-cafe] makeFields without lenses

Nicola Gigante nicola.gigante at gmail.com
Sat Oct 4 09:57:16 UTC 2014

Good morning to everyone.

I really love what makeFields from
Control.Lens.TH does: generating
a typeclasse HasXXX for each
field _typeXXX and instances of the class
for each type that has a record field
with the same name.

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? Or can I
configure the parameters of makeFieldsWith
to generate simple functions instead of

Another related question: if I use makeFields
in more than one module, and different records
have fields with the same name, the generated
typeclasses will have the same name but will
be different, because declared twice in different 
modules, am I right? Is there a way to use a unique
typeclass in the whole project for every generated
field of the same name? 

Thank you very much,

More information about the Haskell-Cafe mailing list