diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-13 22:25:28 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-13 22:25:28 +0100 |
commit | cfac1bbca6e5950d8abdc8329e84de4794e08677 (patch) | |
tree | b0fc802c209dd1fd8ec59c0c490c115b9bd59651 /src/Hakyll/Core | |
parent | 089670629bc0f84c74fef520772caec842d2a549 (diff) | |
download | hakyll-cfac1bbca6e5950d8abdc8329e84de4794e08677.tar.gz |
Rename require to load, thanks @ddfreyne
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r-- | src/Hakyll/Core/Compiler.hs | 12 | ||||
-rw-r--r-- | src/Hakyll/Core/Compiler/Require.hs | 54 | ||||
-rw-r--r-- | src/Hakyll/Core/Runtime.hs | 2 |
3 files changed, 34 insertions, 34 deletions
diff --git a/src/Hakyll/Core/Compiler.hs b/src/Hakyll/Core/Compiler.hs index 94f1ef2..9a8f923 100644 --- a/src/Hakyll/Core/Compiler.hs +++ b/src/Hakyll/Core/Compiler.hs @@ -13,12 +13,12 @@ module Hakyll.Core.Compiler , Internal.Snapshot , saveSnapshot - , Internal.require - , Internal.requireSnapshot - , Internal.requireBody - , Internal.requireSnapshotBody - , Internal.requireAll - , Internal.requireAllSnapshots + , Internal.load + , Internal.loadSnapshot + , Internal.loadBody + , Internal.loadSnapshotBody + , Internal.loadAll + , Internal.loadAllSnapshots , cached , unsafeCompiler diff --git a/src/Hakyll/Core/Compiler/Require.hs b/src/Hakyll/Core/Compiler/Require.hs index 3571bf6..ef3b11b 100644 --- a/src/Hakyll/Core/Compiler/Require.hs +++ b/src/Hakyll/Core/Compiler/Require.hs @@ -3,12 +3,12 @@ module Hakyll.Core.Compiler.Require ( Snapshot , save , saveSnapshot - , require - , requireSnapshot - , requireBody - , requireSnapshotBody - , requireAll - , requireAllSnapshots + , load + , loadSnapshot + , loadBody + , loadSnapshotBody + , loadAll + , loadAllSnapshots ) where @@ -44,7 +44,7 @@ save store item = saveSnapshot store final item -------------------------------------------------------------------------------- -- | Save a specific snapshot of an item, so you can load it later using --- 'requireSnapshot'. +-- 'loadSnapshot'. saveSnapshot :: (Binary a, Typeable a) => Store -> Snapshot -> Item a -> IO () saveSnapshot store snapshot item = @@ -54,15 +54,15 @@ saveSnapshot store snapshot item = -------------------------------------------------------------------------------- -- | Load an item compiled elsewhere. If the required item is not yet compiled, -- the build system will take care of that automatically. -require :: (Binary a, Typeable a) => Identifier -> Compiler (Item a) -require id' = requireSnapshot id' final +load :: (Binary a, Typeable a) => Identifier -> Compiler (Item a) +load id' = loadSnapshot id' final -------------------------------------------------------------------------------- -- | Require a specific snapshot of an item. -requireSnapshot :: (Binary a, Typeable a) - => Identifier -> Snapshot -> Compiler (Item a) -requireSnapshot id' snapshot = do +loadSnapshot :: (Binary a, Typeable a) + => Identifier -> Snapshot -> Compiler (Item a) +loadSnapshot id' snapshot = do store <- compilerStore <$> compilerAsk universe <- compilerUniverse <$> compilerAsk @@ -78,12 +78,12 @@ requireSnapshot id' snapshot = do Store.Found x -> return $ Item id' x where notFound = - "Hakyll.Core.Compiler.Require.require: " ++ show id' ++ + "Hakyll.Core.Compiler.Require.load: " ++ show id' ++ " (snapshot " ++ snapshot ++ ") was not found in the cache, " ++ "the cache might be corrupted or " ++ "the item you are referring to might not exist" wrongType e r = - "Hakyll.Core.Compiler.Require.require: " ++ show id' ++ + "Hakyll.Core.Compiler.Require.load: " ++ show id' ++ " (snapshot " ++ snapshot ++ ") was found in the cache, " ++ "but does not have the right type: expected " ++ show e ++ " but got " ++ show r @@ -92,29 +92,29 @@ requireSnapshot id' snapshot = do -------------------------------------------------------------------------------- -- | A shortcut for only requiring the body of an item. -- --- > requireBody = fmap itemBody . require -requireBody :: (Binary a, Typeable a) => Identifier -> Compiler a -requireBody id' = requireSnapshotBody id' final +-- > loadBody = fmap itemBody . load +loadBody :: (Binary a, Typeable a) => Identifier -> Compiler a +loadBody id' = loadSnapshotBody id' final -------------------------------------------------------------------------------- -requireSnapshotBody :: (Binary a, Typeable a) - => Identifier -> Snapshot -> Compiler a -requireSnapshotBody id' snapshot = fmap itemBody $ requireSnapshot id' snapshot +loadSnapshotBody :: (Binary a, Typeable a) + => Identifier -> Snapshot -> Compiler a +loadSnapshotBody id' snapshot = fmap itemBody $ loadSnapshot id' snapshot -------------------------------------------------------------------------------- --- | This function allows you to 'require' a dynamic list of items -requireAll :: (Binary a, Typeable a) => Pattern -> Compiler [Item a] -requireAll pattern = requireAllSnapshots pattern final +-- | This function allows you to 'load' a dynamic list of items +loadAll :: (Binary a, Typeable a) => Pattern -> Compiler [Item a] +loadAll pattern = loadAllSnapshots pattern final -------------------------------------------------------------------------------- -requireAllSnapshots :: (Binary a, Typeable a) - => Pattern -> Snapshot -> Compiler [Item a] -requireAllSnapshots pattern snapshot = do +loadAllSnapshots :: (Binary a, Typeable a) + => Pattern -> Snapshot -> Compiler [Item a] +loadAllSnapshots pattern snapshot = do matching <- getMatches pattern - mapM (\i -> requireSnapshot i snapshot) matching + mapM (\i -> loadSnapshot i snapshot) matching -------------------------------------------------------------------------------- diff --git a/src/Hakyll/Core/Runtime.hs b/src/Hakyll/Core/Runtime.hs index 63e2414..2943942 100644 --- a/src/Hakyll/Core/Runtime.hs +++ b/src/Hakyll/Core/Runtime.hs @@ -212,7 +212,7 @@ chase trail id' liftIO $ write path item Logger.debug logger $ "Routed to " ++ path - -- Save! (For require) + -- Save! (For load) liftIO $ save store item -- Update state |