Adding swap to Data.Tuple

Bertram Felgenhauer bertram.felgenhauer at
Tue Jun 16 20:26:02 EDT 2009

roconnor at wrote:
> I have a new proposal to add swap and swap' to Data.Tuple

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.

To provide the extra laziness, my favourite haskell compiler will have
to create and later evaluate two thunks in addition to allocating a
new pair.

In other words, I'd rather add only one function,

   swap (a, b) = (b, a)



More information about the Libraries mailing list