diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-12-05 12:27:45 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-12-05 12:27:45 +0100 |
commit | 98d03dfe488c7d9e09101ac442912bc65bb39f23 (patch) | |
tree | 2cd83ea267dc4709f253ac50072fb65f927d463f /src/Hakyll/Core/Rules/Internal.hs | |
parent | 949afd2578c3f07ded666ae7ef1fde50c87bee5b (diff) | |
download | hakyll-98d03dfe488c7d9e09101ac442912bc65bb39f23.tar.gz |
Revert "Throw an error in case of duplicate compilers"
This reverts commit ffbce966075d258b16b44e6856333ef41e4487f4.
Diffstat (limited to 'src/Hakyll/Core/Rules/Internal.hs')
-rw-r--r-- | src/Hakyll/Core/Rules/Internal.hs | 22 |
1 files changed, 5 insertions, 17 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 |