
18 Jan
2016
18 Jan
'16
9:50 p.m.
On Mon, 18 Jan 2016, Ryan Scott wrote:
Edward Kmett outlines his reasons why he finds instances for (,) useful here: https://www.reddit.com/r/haskell/comments/3pfg7x/either_and_in_haskell_are_n...
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.
Sounds like a nice application of the Writer monad, doesn't it? "Writer" would be much more explicit about what you want to achieve.