Hi,
Post by Ivan PerezThe function \x -> (x,x) is very convenient when working with arrows.
Would it be appropriate to add it to Data.Tuple?
I'm not opposed. Should this be called dup or diagonal? What about
larger tuples?
There is precedent in the arrow literature for calling this function
"dup"
It would indeed be unfortunate if it was not called "dup".
One could argue, as David (I'm guessing) does, that it's a bit of an
odd definition to add to Data.Tuple as it only works for pairs
(as implied by its name).
And the reason it's convenient for Arrows is that (standard) Arrows
are defined in a way that relies on pairs.
So maybe it should somehow be defined in relation with Arrows.
But then again, all other functions in Data.Tuple are at present
specific to pairs ("fst", "snd", "swap", ...).
So "dup" would certainly not look out of place there.
Best,
/Henrik
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.
Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.