@@ -3,12 +3,12 @@ module Hakyll.Core.Compiler.Require
5 , saveSnapshot
5 , saveSnapshot
7− , requireSnapshot
7+ , loadSnapshot
8− , requireBody
8+ , loadBody
9− , requireSnapshotBody
9+ , loadSnapshotBody
10− , requireAll
10+ , loadAll
11− , requireAllSnapshots
11+ , loadAllSnapshots
@@ -44,7 +44,7 @@ save store item = saveSnapshot store final item
45--------------------------------------------------------------------------------
45--------------------------------------------------------------------------------
46-- | Save a specific snapshot of an item, so you can load it later using
46-- | Save a specific snapshot of an item, so you can load it later using
47−-- 'requireSnapshot'.
47+-- 'loadSnapshot'.
48saveSnapshot :: (Binary a, Typeable a)
48saveSnapshot :: (Binary a, Typeable a)
49 => Store -> Snapshot -> Item a -> IO ()
49 => Store -> Snapshot -> Item a -> IO ()
50saveSnapshot store snapshot item =
50saveSnapshot store snapshot item =
@@ -54,15 +54,15 @@ saveSnapshot store snapshot item =
54--------------------------------------------------------------------------------
54--------------------------------------------------------------------------------
55-- | Load an item compiled elsewhere. If the required item is not yet compiled,
55-- | Load an item compiled elsewhere. If the required item is not yet compiled,
56-- the build system will take care of that automatically.
56-- the build system will take care of that automatically.
57−require :: (Binary a, Typeable a) => Identifier -> Compiler (Item a)
57+load :: (Binary a, Typeable a) => Identifier -> Compiler (Item a)
58−require id' = requireSnapshot id' final
58+load id' = loadSnapshot id' final
61--------------------------------------------------------------------------------
61--------------------------------------------------------------------------------
62-- | Require a specific snapshot of an item.
62-- | Require a specific snapshot of an item.
63−requireSnapshot :: (Binary a, Typeable a)
63+loadSnapshot :: (Binary a, Typeable a)
64− => Identifier -> Snapshot -> Compiler (Item a)
64+ => Identifier -> Snapshot -> Compiler (Item a)
65−requireSnapshot id' snapshot = do
65+loadSnapshot id' snapshot = do
66 store <- compilerStore <$> compilerAsk
66 store <- compilerStore <$> compilerAsk
67 universe <- compilerUniverse <$> compilerAsk
67 universe <- compilerUniverse <$> compilerAsk
@@ -78,12 +78,12 @@ requireSnapshot id' snapshot = do
78 Store.Found x -> return $ Item id' x
78 Store.Found x -> return $ Item id' x
80 notFound =
80 notFound =
81− "Hakyll.Core.Compiler.Require.require: " ++ show id' ++
81+ "Hakyll.Core.Compiler.Require.load: " ++ show id' ++
82 " (snapshot " ++ snapshot ++ ") was not found in the cache, " ++
82 " (snapshot " ++ snapshot ++ ") was not found in the cache, " ++
83 "the cache might be corrupted or " ++
83 "the cache might be corrupted or " ++
84 "the item you are referring to might not exist"
84 "the item you are referring to might not exist"
85 wrongType e r =
85 wrongType e r =
86− "Hakyll.Core.Compiler.Require.require: " ++ show id' ++
86+ "Hakyll.Core.Compiler.Require.load: " ++ show id' ++
87 " (snapshot " ++ snapshot ++ ") was found in the cache, " ++
87 " (snapshot " ++ snapshot ++ ") was found in the cache, " ++
88 "but does not have the right type: expected " ++ show e ++
88 "but does not have the right type: expected " ++ show e ++
89 " but got " ++ show r
89 " but got " ++ show r
@@ -92,29 +92,29 @@ requireSnapshot id' snapshot = do
92--------------------------------------------------------------------------------
92--------------------------------------------------------------------------------
93-- | A shortcut for only requiring the body of an item.
93-- | A shortcut for only requiring the body of an item.
95−-- > requireBody = fmap itemBody . require
95+-- > loadBody = fmap itemBody . load
96−requireBody :: (Binary a, Typeable a) => Identifier -> Compiler a
96+loadBody :: (Binary a, Typeable a) => Identifier -> Compiler a
97−requireBody id' = requireSnapshotBody id' final
97+loadBody id' = loadSnapshotBody id' final
100--------------------------------------------------------------------------------
100--------------------------------------------------------------------------------
101−requireSnapshotBody :: (Binary a, Typeable a)
101+loadSnapshotBody :: (Binary a, Typeable a)
102− => Identifier -> Snapshot -> Compiler a
102+ => Identifier -> Snapshot -> Compiler a
103−requireSnapshotBody id' snapshot = fmap itemBody $ requireSnapshot id' snapshot
103+loadSnapshotBody id' snapshot = fmap itemBody $ loadSnapshot id' snapshot
106--------------------------------------------------------------------------------
106--------------------------------------------------------------------------------
107−-- | This function allows you to 'require' a dynamic list of items
107+-- | This function allows you to 'load' a dynamic list of items
108−requireAll :: (Binary a, Typeable a) => Pattern -> Compiler [Item a]
108+loadAll :: (Binary a, Typeable a) => Pattern -> Compiler [Item a]
109−requireAll pattern = requireAllSnapshots pattern final
109+loadAll pattern = loadAllSnapshots pattern final
112--------------------------------------------------------------------------------
112--------------------------------------------------------------------------------
113−requireAllSnapshots :: (Binary a, Typeable a)
113+loadAllSnapshots :: (Binary a, Typeable a)
114− => Pattern -> Snapshot -> Compiler [Item a]
114+ => Pattern -> Snapshot -> Compiler [Item a]
115−requireAllSnapshots pattern snapshot = do
115+loadAllSnapshots pattern snapshot = do
116 matching <- getMatches pattern
116 matching <- getMatches pattern
117− mapM (\i -> requireSnapshot i snapshot) matching
117+ mapM (\i -> loadSnapshot i snapshot) matching
120--------------------------------------------------------------------------------
120--------------------------------------------------------------------------------