Commit 3cecd73c authored by Michele Tartara's avatar Michele Tartara
Browse files

Backwards compatibility fix for Lucid



The code introduced by the previous commit triggered a possible library
conflict in Ubuntu Lucid.

This patch introduces an equivalent but more widely acceptable version of
the same code.
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent be0cb2d7
......@@ -230,9 +230,24 @@ determineJobDirectories rootdir archived = do
else return []
return $ rootdir:other
-- Function equivalent to the \'sequence\' function, that cannot be used because
-- of library version conflict on Lucid.
-- FIXME: delete this and just use \'sequence\' instead when Lucid compatibility
-- will not be required anymore.
sequencer :: [Either IOError [JobId]] -> Either IOError [[JobId]]
sequencer l = fmap reverse $ foldl seqFolder (Right []) l
-- | Folding function for joining multiple [JobIds] into one list.
seqFolder :: Either IOError [[JobId]]
-> Either IOError [JobId]
-> Either IOError [[JobId]]
seqFolder (Left e) _ = Left e
seqFolder (Right _) (Left e) = Left e
seqFolder (Right l) (Right el) = Right $ el:l
-- | Computes the list of all jobs in the given directories.
getJobIDs :: [FilePath] -> IO (Either IOError [JobId])
getJobIDs paths = liftM (fmap concat . sequence) (mapM getDirJobIDs paths)
getJobIDs paths = liftM (fmap concat . sequencer) (mapM getDirJobIDs paths)
-- | Sorts the a list of job IDs.
sortJobIDs :: [JobId] -> [JobId]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment