Proposal: Add conspicuously missing Functor instances for tuples
Mario Blažević
mblazevic at stilo.com
Wed Jan 20 14:43:54 UTC 2016
On 16-01-18 04:17 PM, amindfv at gmail.com wrote:
> I share Henning's concerns. Can someone provide a realistic example
> of where an instance for (,,) or (,,,) *is* desirable?
I'm looking at some examples in production code here at work:
> firstOfThree (a, b, c) = a
> onFirstOfThree f = changeNode (\(a, b, c)-> (f a, b, c))
The triple that's being manipulated is local to a bigger function, and
the order of its a, b, c parameters is arbitrary. If this code was
written in presence of the proposed instances, the first parameter would
likely become the last, and at least the latter function would be dropped:
> onLastOfThree = fmap
I'm not convinced there's any downside, so I'm +1 on the proposal.
More information about the Libraries
mailing list