Just some quick English and Hlinting (not a proper review yet)

Resolve issue 1599: automatically expire unused caches
-------------------------------------------------------
> +        hPutStrLn stderr $ "\nI could not reach the following " ++
> +          englishNum (length sources)  (Noun "repository") " (listed in 
> _darcs/prefs/sources):"
> +        hPutStrLn stderr $ (unlines sources) ++  "\nIt is recommendable to 
> delete the " ++
> +         englishNum (length sources)  (Noun "entry") " listed aboved if not 
> used"

How about this?

 I could not reach the repositories:
   foo
   bar
   baz
   quux
 If you're not using them, you should probably delete the
 the corresponding entries from _darcs/prefs/sources

> +isBadSource :: IO (String -> Bool)
> +isBadSource = do badSources <- getBadSourcesList
> +                 return (`elem` badSources)

Thanks for getting rid of the needless unsafePerformIO

> +checkCacheReachability :: String -> CacheLoc -> IO ()
> +checkCacheReachability e cache
> + | isFile (source cache) = do
> +   reachable <- isReachableSource
> +   if not $ reachable (source cache)
> +     then
> +      do
> +       exist <- doesDirectoryExist $ source cache
> +       when (not exist) $ addBadSource $ source cache
> +       when exist $ addReachableSource $ source cache
> +     else
> +       return ()

I think you want
      
      unless (reachable (source cache)) $ do

You could also maybe refactor this a little bit with a helper function
that takes the (String -> Bool) function as an argument.  Not sure  if
that would be a good thing.

> +      else if reachable $ source cache
> +            then return  ()
> +            else

see above

> + | otherwise                  = fail $ "unknown transport protocol for: " ++ 
> source cache

those spaces are bit superfluous

Overall, I think your code is looking a lot cleaner now!

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, please try +44 (0)1273 64 2905.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to