Revision 3cecd73c
b/src/Ganeti/JQueue.hs | ||
---|---|---|
230 | 230 |
else return [] |
231 | 231 |
return $ rootdir:other |
232 | 232 |
|
233 |
-- Function equivalent to the \'sequence\' function, that cannot be used because |
|
234 |
-- of library version conflict on Lucid. |
|
235 |
-- FIXME: delete this and just use \'sequence\' instead when Lucid compatibility |
|
236 |
-- will not be required anymore. |
|
237 |
sequencer :: [Either IOError [JobId]] -> Either IOError [[JobId]] |
|
238 |
sequencer l = fmap reverse $ foldl seqFolder (Right []) l |
|
239 |
|
|
240 |
-- | Folding function for joining multiple [JobIds] into one list. |
|
241 |
seqFolder :: Either IOError [[JobId]] |
|
242 |
-> Either IOError [JobId] |
|
243 |
-> Either IOError [[JobId]] |
|
244 |
seqFolder (Left e) _ = Left e |
|
245 |
seqFolder (Right _) (Left e) = Left e |
|
246 |
seqFolder (Right l) (Right el) = Right $ el:l |
|
247 |
|
|
233 | 248 |
-- | Computes the list of all jobs in the given directories. |
234 | 249 |
getJobIDs :: [FilePath] -> IO (Either IOError [JobId]) |
235 |
getJobIDs paths = liftM (fmap concat . sequence) (mapM getDirJobIDs paths) |
|
250 |
getJobIDs paths = liftM (fmap concat . sequencer) (mapM getDirJobIDs paths)
|
|
236 | 251 |
|
237 | 252 |
-- | Sorts the a list of job IDs. |
238 | 253 |
sortJobIDs :: [JobId] -> [JobId] |
Also available in: Unified diff