Proposal: Add conspicuously missing Functor instances for tuples

Ryan Scott at
Mon Jan 18 21:46:34 UTC 2016

Edward Kmett outlines his reasons why he finds instances for (,)
useful here:

Speaking for myself, I find the Traversable instance for (,)
incredibly useful. It's quite nice to build up a list of results
alongside a state (i.e, (state, [result]) ), and then traverse over
each of the results such that the new results each have their own copy
of the state (i.e., [(state, result)] ). That kind of patterns arises
quite often in lensy code, and the Traversable instance for (,) is
perfect for the job.

Right now, if you want to have two different states, you have to
employ a kludge (something like ((state1, state2), [result]) ) to get
around the fact that there's no Traversable instance for (,,), (,,,),

Ryan S.

More information about the Libraries mailing list