
Russell O'Connor wrote:
I have a new proposal to add swap and swap' to Data.Tuple swap ~(a,b) = (b,a) swap' (a,b) = (b,a)
Bertram Felgenhauer wrote:
I'd ask the opposite of Neil's question - what is a good use case for the extra laziness that swap provides over swap'? It seems to fill a rather small niche to me.
Well, another natural way of writing it would be swap = uncurry $ flip (,) which supports the lazy version as default. But Bertram is right, in practice we know that there will never be an advantage to pushing off until later the "hard work" of swapping the order of the tuple. So we should make it strict by default. Let's not fall into the trap of "sum" and "product", where the default is idiotically lazy, and now we have to fight to get it fixed. Regards, Yitz