on master help sign in
Style nazi strikes!
commitedfdb7d677e443a6809b1d98e54d861898109412 authorJasper Van der Jeugt <m@jaspervdj.be> dateWed 8 Aug 2012, 09:37 (14 years ago) parentfdc6243
2 files changed+12−9
src/Hakyll/Core/Resource/Provider.hs+4−3 src/Hakyll/Core/Store.hs+8−6
src/Hakyll/Core/Resource/Provider.hs+4−3
@@ -36,8 +36,8 @@ import Hakyll.Core.Resource
3636-- | A value responsible for retrieving and listing resources
3737--
3838data ResourceProvider = ResourceProvider
39− { -- | A list of all resources this provider is able to provide
40− resourceSet :: S.Set Resource
39+ { -- | A set of all resources this provider is able to provide
40+ resourceSet :: S.Set Resource
4141 , -- | Retrieve a certain resource as string
4242 resourceString :: Resource -> IO String
4343 , -- | Retrieve a certain resource as lazy bytestring
@@ -55,7 +55,8 @@ makeResourceProvider :: [Resource] -- ^ Resource list
5555 -> (Resource -> IO LB.ByteString) -- ^ ByteString reader
5656 -> (Resource -> IO UTCTime) -- ^ Time checker
5757 -> IO ResourceProvider -- ^ Resulting provider
58−makeResourceProvider l s b t = ResourceProvider (S.fromList l) s b t <$> newMVar M.empty
58+makeResourceProvider l s b t =
59+ ResourceProvider (S.fromList l) s b t <$> newMVar M.empty
5960
6061-- | Get the list of all resources
6162resourceList :: ResourceProvider -> [Resource]
src/Hakyll/Core/Store.hs+8−6
@@ -54,7 +54,9 @@ makeStore :: Bool -- ^ Use in-memory caching
5454 -> FilePath -- ^ Directory to use for hard disk storage
5555 -> IO Store -- ^ Store
5656makeStore inMemory directory = do
57− lru <- if inMemory then Just <$> LRU.newAtomicLRU storeLRUSize else return Nothing
57+ lru <- if inMemory
58+ then Just <$> LRU.newAtomicLRU storeLRUSize
59+ else return Nothing
5860 return Store
5961 { storeDirectory = directory
6062 , storeLRU = lru
@@ -63,7 +65,7 @@ makeStore inMemory directory = do
6365-- | Auxiliary: add an item to the map
6466--
6567cacheInsert :: (Binary a, Typeable a) => Store -> FilePath -> a -> IO ()
66−cacheInsert (Store _ Nothing) _ _ = return ()
68+cacheInsert (Store _ Nothing) _ _ = return ()
6769cacheInsert (Store _ (Just lru)) path value =
6870 LRU.insert path (Storable value) lru
6971
@@ -75,10 +77,10 @@ cacheLookup (Store _ Nothing) _ = return NotFound
7577cacheLookup (Store _ (Just lru)) path = do
7678 res <- LRU.lookup path lru
7779 case res of
78− Nothing -> return NotFound
79− Just (Storable s) -> return $ case cast s of
80− Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)
81− Just s' -> Found s'
80+ Nothing -> return NotFound
81+ Just (Storable s) -> return $ case cast s of
82+ Nothing -> WrongType (typeOf s) $ typeOf (undefined :: a)
83+ Just s' -> Found s'
8284
8385-- | Create a path
8486--