diff options
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r-- | src/Hakyll/Core/Resource/Provider.hs | 7 | ||||
-rw-r--r-- | src/Hakyll/Core/Store.hs | 14 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/Hakyll/Core/Resource/Provider.hs b/src/Hakyll/Core/Resource/Provider.hs index 14848a8..ebd5984 100644 --- a/src/Hakyll/Core/Resource/Provider.hs +++ b/src/Hakyll/Core/Resource/Provider.hs @@ -36,8 +36,8 @@ import Hakyll.Core.Resource -- | A value responsible for retrieving and listing resources -- data ResourceProvider = ResourceProvider - { -- | A list of all resources this provider is able to provide - resourceSet :: S.Set Resource + { -- | A set of all resources this provider is able to provide + resourceSet :: S.Set Resource , -- | Retrieve a certain resource as string resourceString :: Resource -> IO String , -- | Retrieve a certain resource as lazy bytestring @@ -55,7 +55,8 @@ makeResourceProvider :: [Resource] -- ^ Resource list -> (Resource -> IO LB.ByteString) -- ^ ByteString reader -> (Resource -> IO UTCTime) -- ^ Time checker -> IO ResourceProvider -- ^ Resulting provider -makeResourceProvider l s b t = ResourceProvider (S.fromList l) s b t <$> newMVar M.empty +makeResourceProvider l s b t = + ResourceProvider (S.fromList l) s b t <$> newMVar M.empty -- | Get the list of all resources resourceList :: ResourceProvider -> [Resource] diff --git a/src/Hakyll/Core/Store.hs b/src/Hakyll/Core/Store.hs index 0b5f438..ae94ae8 100644 --- a/src/Hakyll/Core/Store.hs +++ b/src/Hakyll/Core/Store.hs @@ -54,7 +54,9 @@ makeStore :: Bool -- ^ Use in-memory caching -> FilePath -- ^ Directory to use for hard disk storage -> IO Store -- ^ Store makeStore inMemory directory = do - lru <- if inMemory then Just <$> LRU.newAtomicLRU storeLRUSize else return Nothing + lru <- if inMemory + then Just <$> LRU.newAtomicLRU storeLRUSize + else return Nothing return Store { storeDirectory = directory , storeLRU = lru @@ -63,7 +65,7 @@ makeStore inMemory directory = do -- | Auxiliary: add an item to the map -- cacheInsert :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO () -cacheInsert (Store _ Nothing) _ _ = return () +cacheInsert (Store _ Nothing) _ _ = return () cacheInsert (Store _ (Just lru)) path value = LRU.insert path (Storable value) lru @@ -75,10 +77,10 @@ cacheLookup (Store _ Nothing) _ = return NotFound cacheLookup (Store _ (Just lru)) path = do res <- LRU.lookup path lru case res of - Nothing -> return NotFound - Just (Storable s) -> return $ case cast s of - Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a) - Just s' -> Found s' + Nothing -> return NotFound + Just (Storable s) -> return $ case cast s of + Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a) + Just s' -> Found s' -- | Create a path -- |