So initially I wrote:
xs <- getAddrInfo (Just hints) (Just addr) (Just port)
then it seemed to me that the function 'Just :: a -> Maybe a' is kind of "mapped" over 'hints', 'addr', and 'port', so I came up with something like this:
map_arg g f a b c = f (g a) (g b) (g c)
xs <- map_arg Just getAddrInfo hints addr port
but GHC expects (g a), (g b) and (g c) to be of the same type, so this doesn't type check.
Is there a way to do this, or more generically, is there a way to map a function over the arguments of another function?