"Data.TupleFields" for review

Henning Thielemann lemming at henning-thielemann.de
Thu Aug 9 11:29:47 EDT 2007


On Thu, 9 Aug 2007, Isaac Dupree wrote:

> Henning Thielemann wrote:
> >   Translated to the tuple issue, I use only one function of type
> >     field1 :: f -> t -> (f,t)
> >   which is a combination of 'get' and 'set'.
> >   Using this function you can implement a generic 'set', 'get', and
> > 'update'. Of course, you can argue that it is bad style to put the
> > distinct 'set' and 'get' functionalities into one function.
>
> I like that style. It reminds me of the zipper pattern, of accessors (or
> something like that).  ...which is more important for more complicated
> things (Maps?) (Uniplate.)
>
> I don't know when I'd want to use a function polymorphic in tuple size -
> _personally_ I'd rather stick to simpler types and ... probably
> pattern-matching.

Me too. I think, I've never used other tuples than pairs and triples.
Records are much clearer and safer.


More information about the Libraries mailing list