Apply function and wrap in tuple in Haskell

Viewed 191

I am looking for a way to write a function that applies a provided function and wraps argument and function result inside a tuple. Such as:

applyZip :: (a -> b) -> a -> (a,b)
applyZip f x = (x, f x)

Is there a more idiomatic way to write this in Haskell, preferably with library code?

Edit: I was just genuinely interested in other approaches to solve this. If you find your self in the same problem, implementing the function yourself with a descriptive name might be preferable.

1 Answers
Related