g → String → IO (Maybe (String, Maybe String))
getPassword maipath host user = do
  aipath ← case maipath of
             Nothing → fmap (<> "/.authinfo") $ System.Environment.getEnv "HOME"
             Just p  → pure p
  mainfo ← readAuthInfoFile aipath
  pure $ join $ fmap (fmap (\ (_,_,pass,port) -> (pass,port))
                     ∘
                      find (\ (h,u,_,_) -> h == host && u == user))
                mainfo

getPassword ∷ Maybe String → String → String → IO (Maybe (String, Maybe String))
getPassword maipath host user = do
  aipath ← case maipath of
             Nothing → fmap (<> "/.authinfo") $ System.Environment.getEnv "HOME"
             Just p  → pure p
  mainfo ← readAuthInfoFile aipath
  pure $ join $ fmap (fmap (\ (_,_,pass,port) -> (pass,port))
                     ∘
                      find (\ (h,u,_,_) -> h == host && u == user))
                mainfo
getPassword maipath host user = do
  aipath ← case maipath of
             Nothing → fmap (<> "/.authinfo") $ System.Environment.getEnv "HOME"
             Just p  → pure p
  mainfo ← readAuthInfoFile aipath
  pure $ join $ fmap (fmap (\ (_,_,pass,port) -> (pass,port))
                     ∘
                      find (\ (h,u,_,_) -> h == host && u == user))
                mainfo