From 8a294a6accb4231fcad2905054ace92964bdce8e Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Sun, 5 Jun 2016 08:09:52 -0400 Subject: [PATCH] Don't cache an empty list of matches Why? ==== If a list of matches is empty, there's no reason to cache it. --- src/Unused/Cache.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Unused/Cache.hs b/src/Unused/Cache.hs index a0bbc7d..bfdcc4e 100644 --- a/src/Unused/Cache.hs +++ b/src/Unused/Cache.hs @@ -16,6 +16,7 @@ cached context f = fromCache = maybe (writeCache =<< liftReaderT f) return =<< readCache writeCache :: ToRecord a => [a] -> ReaderT String IO [a] +writeCache [] = return [] writeCache contents = do liftReaderT $ createDirectoryIfMissing True cacheDirectory fileName <- ask