summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/Rules/Internal.hs22
-rw-r--r--src/Hakyll/Core/Runtime.hs3
2 files changed, 6 insertions, 19 deletions
diff --git a/src/Hakyll/Core/Rules/Internal.hs b/src/Hakyll/Core/Rules/Internal.hs
index 72166c8..a7c2059 100644
--- a/src/Hakyll/Core/Rules/Internal.hs
+++ b/src/Hakyll/Core/Rules/Internal.hs
@@ -16,7 +16,6 @@ import Control.Applicative (Applicative, (<$>))
import Control.Monad.Reader (ask)
import Control.Monad.RWS (RWST, runRWST)
import Control.Monad.Trans (liftIO)
-import Data.Map (Map)
import qualified Data.Map as M
import Data.Monoid (Monoid, mappend, mempty)
import Data.Set (Set)
@@ -98,26 +97,15 @@ runRules rules provider = do
(_, _, ruleSet) <- runRWST (unRules rules) env emptyRulesState
-- Ensure compiler uniqueness
- uniqueCompilers <- case fromListUnique (rulesCompilers ruleSet) of
- Right m -> return m
- Left id' -> error $
- "Hakyll.Core.Rules.Internal.runRules: duplicate compiler for " ++
- show id'
+ let ruleSet' = ruleSet
+ { rulesCompilers = M.toList $
+ M.fromListWith (flip const) (rulesCompilers ruleSet)
+ }
- return ruleSet {rulesCompilers = M.toList uniqueCompilers}
+ return ruleSet'
where
env = RulesRead
{ rulesProvider = provider
, rulesMatches = []
, rulesVersion = Nothing
}
-
-
---------------------------------------------------------------------------------
-fromListUnique :: Ord k => [(k, v)] -> Either k (Map k v)
-fromListUnique = go M.empty
- where
- go m [] = Right m
- go m ((k, v) : zs) = case M.lookup k m of
- Nothing -> go (M.insert k v m) zs
- Just _ -> Left k
diff --git a/src/Hakyll/Core/Runtime.hs b/src/Hakyll/Core/Runtime.hs
index 208fcc3..824d11b 100644
--- a/src/Hakyll/Core/Runtime.hs
+++ b/src/Hakyll/Core/Runtime.hs
@@ -53,8 +53,7 @@ run config verbosity rules = do
provider <- newProvider store (shouldIgnoreFile config) $
providerDirectory config
Logger.message logger "Running rules..."
- Logger.flush logger
- ruleSet <- runRules rules provider
+ ruleSet <- runRules rules provider
-- Get old facts
mOldFacts <- Store.get store factsKey