expose Control.Monad.join

I think I've been looking for that function for some time.
Ie, I remember wanting to collapse Just Nothing to Nothing.
This commit is contained in:
Joey Hess 2013-04-22 20:24:53 -04:00
parent 2a84deb271
commit 8a2d1988d3
19 changed files with 30 additions and 32 deletions

View file

@ -105,11 +105,11 @@ removeAuthorizedKeys rsynconly dir pubkey = do
- present.
-}
addAuthorizedKeysCommand :: Bool -> FilePath -> SshPubKey -> String
addAuthorizedKeysCommand rsynconly dir pubkey = join "&&"
addAuthorizedKeysCommand rsynconly dir pubkey = intercalate "&&"
[ "mkdir -p ~/.ssh"
, join "; "
, intercalate "; "
[ "if [ ! -e " ++ wrapper ++ " ]"
, "then (" ++ join ";" (map echoval script) ++ ") > " ++ wrapper
, "then (" ++ intercalate ";" (map echoval script) ++ ") > " ++ wrapper
, "fi"
]
, "chmod 700 " ++ wrapper
@ -217,7 +217,7 @@ mangleSshHostName :: SshData -> String
mangleSshHostName sshdata = "git-annex-" ++ T.unpack (sshHostName sshdata)
++ "-" ++ filter safe extra
where
extra = join "_" $ map T.unpack $ catMaybes
extra = intercalate "_" $ map T.unpack $ catMaybes
[ sshUserName sshdata
, Just $ sshDirectory sshdata
]
@ -229,7 +229,7 @@ mangleSshHostName sshdata = "git-annex-" ++ T.unpack (sshHostName sshdata)
{- Extracts the real hostname from a mangled ssh hostname. -}
unMangleSshHostName :: String -> String
unMangleSshHostName h = case split "-" h of
("git":"annex":rest) -> join "-" (beginning rest)
("git":"annex":rest) -> intercalate "-" (beginning rest)
_ -> h
{- Does ssh have known_hosts data for a hostname? -}

View file

@ -205,7 +205,7 @@ testServer sshinput@(SshInput { inputHostname = Just hn }) = do
, rsyncOnly = status == UsableRsyncServer
}
probe extraopts = do
let remotecommand = shellWrap $ join ";"
let remotecommand = shellWrap $ intercalate ";"
[ report "loggedin"
, checkcommand "git-annex-shell"
, checkcommand "rsync"
@ -287,7 +287,7 @@ makeSsh' rsync setup sshdata keypair =
where
sshhost = genSshHost (sshHostName sshdata) (sshUserName sshdata)
remotedir = T.unpack $ sshDirectory sshdata
remoteCommand = shellWrap $ join "&&" $ catMaybes
remoteCommand = shellWrap $ intercalate "&&" $ catMaybes
[ Just $ "mkdir -p " ++ shellEscape remotedir
, Just $ "cd " ++ shellEscape remotedir
, if rsync then Nothing else Just "if [ ! -d .git ]; then git init --bare --shared; fi"
@ -353,7 +353,7 @@ makeRsyncNet sshinput reponame setup = do
- one recommended by rsync.net documentation. I touch the file first
- to not need to use a different method to create it.
-}
let remotecommand = join ";"
let remotecommand = intercalate ";"
[ "mkdir -p .ssh"
, "touch .ssh/authorized_keys"
, "dd of=.ssh/authorized_keys oflag=append conv=notrunc"

View file

@ -97,7 +97,7 @@ xmppPush cid gitpush handledeferred = runPush SendPack cid handledeferred $ do
env <- liftIO getEnvironment
path <- liftIO getSearchPath
let myenv = M.fromList
[ ("PATH", join [searchPathSeparator] $ tmpdir:path)
[ ("PATH", intercalate [searchPathSeparator] $ tmpdir:path)
, (relayIn, show inf)
, (relayOut, show outf)
, (relayControl, show controlf)