From 98d03dfe488c7d9e09101ac442912bc65bb39f23 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 5 Dec 2013 12:27:45 +0100 Subject: Revert "Throw an error in case of duplicate compilers" This reverts commit ffbce966075d258b16b44e6856333ef41e4487f4. --- src/Hakyll/Core/Rules/Internal.hs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/Hakyll/Core/Rules/Internal.hs') 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 -- cgit v1.2.3