Proposal: Add conspicuously missing Functor instances for tuples
Henning Thielemann
lemming at henning-thielemann.de
Mon Jan 18 21:50:15 UTC 2016
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_not_arbitrary/cw65ck2
>
> 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.
More information about the Libraries
mailing list