diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-09 16:34:45 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-09 16:34:45 +0100 |
commit | 1319bbfe4ab3ddd321bcbb902bba7392ad868324 (patch) | |
tree | 5fdcad316015db237b18ff7e22e0e73c5044cc6f /src/Hakyll/Core/Rules.hs | |
parent | dac3fac342c2fb8610b6f1d83cbfd97a70cf17f1 (diff) | |
download | hakyll-1319bbfe4ab3ddd321bcbb902bba7392ad868324.tar.gz |
Remove Resource type
Diffstat (limited to 'src/Hakyll/Core/Rules.hs')
-rw-r--r-- | src/Hakyll/Core/Rules.hs | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/Hakyll/Core/Rules.hs b/src/Hakyll/Core/Rules.hs index ff68c56..5ac63bc 100644 --- a/src/Hakyll/Core/Rules.hs +++ b/src/Hakyll/Core/Rules.hs @@ -51,11 +51,9 @@ import Hakyll.Core.CompiledItem import Hakyll.Core.Compiler.Internal import Hakyll.Core.Identifier import Hakyll.Core.Identifier.Pattern -import Hakyll.Core.Resource -import Hakyll.Core.Resource.Provider +import Hakyll.Core.ResourceProvider import Hakyll.Core.Routes import Hakyll.Core.Rules.Internal -import Hakyll.Core.Util.Arrow import Hakyll.Core.Writable @@ -80,10 +78,10 @@ tellCompilers compilers = RulesM $ do -------------------------------------------------------------------------------- -- | Add resources -tellResources :: [Resource] +tellResources :: [Identifier a] -> Rules tellResources resources' = RulesM $ tell $ - RuleSet mempty mempty $ S.fromList resources' + RuleSet mempty mempty $ S.fromList $ map castIdentifier resources' -------------------------------------------------------------------------------- @@ -139,13 +137,12 @@ group g = RulesM . local setGroup' . unRulesM -- no resources match the current selection, nothing will happen. In this case, -- you might want to have a look at 'create'. compile :: (Binary a, Typeable a, Writable a) - => Compiler Resource a -> RulesM (Pattern a) + => Compiler () a -> RulesM (Pattern a) compile compiler = do ids <- resources - tellCompilers $ flip map ids $ \identifier -> - (identifier, constA (fromIdentifier identifier) >>> compiler) - tellResources $ map fromIdentifier ids - return $ list ids + tellCompilers [(castIdentifier id', compiler) | id' <- ids] + tellResources ids + return $ list $ map castIdentifier ids -------------------------------------------------------------------------------- @@ -182,14 +179,12 @@ route route' = RulesM $ do -------------------------------------------------------------------------------- -- | Get a list of resources matching the current pattern. This will also set -- the correct group to the identifiers. -resources :: RulesM [Identifier a] +resources :: RulesM [Identifier ()] resources = RulesM $ do - pattern <- rulesPattern <$> ask + pattern <- rulesPattern <$> ask provider <- rulesResourceProvider <$> ask - group' <- rulesGroup <$> ask - return $ filterMatches pattern $ map (toId group') $ resourceList provider - where - toId g = setGroup g . toIdentifier + g <- rulesGroup <$> ask + return $ filterMatches pattern $ map (setGroup g) $ resourceList provider -------------------------------------------------------------------------------- |