Control.Arrow
has the function(&&&)
for this. It has a "more general" type, which unfortunately means that Hoogle doesn't find it (maybe this should be considered a bug in Hoogle?).You can usually figure this sort of thing automatically with
pointfree
, whichlambdabot
in#haskell
has as a plugin.
For example:
<shachaf> @pl combine f g x = (f x, g x)
<lambdabot> combine = liftM2 (,)
Where liftM2
with the (r ->)
instance of Monad
has type (a -> b -> c) -> (r -> a) -> (r -> b) -> r -> c
. Of course, there are many other ways of writing this point-free, depending on what primitives you allow.