Is there a nicer way to apply a function to both elements of a pair in a list than a list comprehension?

haskell

Solution

You can use the `(***)` operator from `Control.Arrow`

> map (f *** f) a

or define your own helper function

> let both f (x, y) = (f x, f y)
> map (both f) a

Problem

I use this a fair bit: ``` a' = [ (f x, f y) | (x, y) <- a ] ``` Is there a better way to do that?

Original source