I just wrote functions like this up to map4
just because they seem useful:
map2 :: Functor f => (i -> a) -> (i -> b) -> f i -> f (a,b)
map2 f1 f2 = fmap $ \i -> (f1 i, f2 i)
Before I continue to map8
i thought I'd ask if there is something similar in some standard module. Hayoo doesn't seem to know any function that has the signature above.
Note: I already found Control.Arrow.&&&
which reduces the above to:
map2 f1 f2 = fmap (f1 &&& f2)
But there doesn't seem to be a similar function for a fanout more than two.