more monadic operator use

This commit is contained in:
Joey Hess 2011-05-15 15:27:49 -04:00
parent 1e5beda86a
commit 6aab88fa25
5 changed files with 11 additions and 20 deletions

View file

@ -150,16 +150,13 @@ mapLog m l =
then Map.insert u l m
else m
where
better = case Map.lookup u m of
Just l' -> (date l' <= date l)
Nothing -> True
better = maybe True (\l' -> date l' <= date l) $ Map.lookup u m
u = uuid l
{- Finds all keys that have location log information.
- (There may be duplicate keys in the list.) -}
loggedKeys :: Git.Repo -> IO [Key]
loggedKeys repo = do
let dir = gitStateDir repo
exists <- doesDirectoryExist dir
if exists
then do
@ -172,3 +169,4 @@ loggedKeys repo = do
else return []
where
tryDirContents d = catch (dirContents d) (return . const [])
dir = gitStateDir repo