Don't cache an empty list of matches

Why?
====

If a list of matches is empty, there's no reason to cache it.
This commit is contained in:
Joshua Clayton 2016-06-05 08:09:52 -04:00
parent 9bf9499e67
commit 8a294a6acc

View File

@ -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