@@ -54,7 +54,9 @@ makeStore :: Bool -- ^ Use in-memory caching
54 -> FilePath -- ^ Directory to use for hard disk storage
54 -> FilePath -- ^ Directory to use for hard disk storage
55 -> IO Store -- ^ Store
55 -> IO Store -- ^ Store
56makeStore inMemory directory = do
56makeStore inMemory directory = do
57− lru <- if inMemory then Just <$> LRU.newAtomicLRU storeLRUSize else return Nothing
58+ then Just <$> LRU.newAtomicLRU storeLRUSize
58 return Store
60 return Store
59 { storeDirectory = directory
61 { storeDirectory = directory
60 , storeLRU = lru
62 , storeLRU = lru
@@ -63,7 +65,7 @@ makeStore inMemory directory = do
63-- | Auxiliary: add an item to the map
65-- | Auxiliary: add an item to the map
65cacheInsert :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO ()
67cacheInsert :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO ()
66−cacheInsert (Store _ Nothing) _ _ = return ()
68+cacheInsert (Store _ Nothing) _ _ = return ()
67cacheInsert (Store _ (Just lru)) path value =
69cacheInsert (Store _ (Just lru)) path value =
68 LRU.insert path (Storable value) lru
70 LRU.insert path (Storable value) lru
@@ -75,10 +77,10 @@ cacheLookup (Store _ Nothing) _ = return NotFound
75cacheLookup (Store _ (Just lru)) path = do
77cacheLookup (Store _ (Just lru)) path = do
76 res <- LRU.lookup path lru
78 res <- LRU.lookup path lru
77 case res of
79 case res of
78− Nothing -> return NotFound
80+ Nothing -> return NotFound
79− Just (Storable s) -> return $ case cast s of
81+ Just (Storable s) -> return $ case cast s of
80− Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)
82+ Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)
81− Just s' -> Found s'
83+ Just s' -> Found s'
83-- | Create a path
85-- | Create a path