From b91c8be54b14a84aa47b5033a9966653df7f84ca Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 24 Feb 2013 10:50:38 +0100 Subject: Update example & tutorials with new recentFirst --- data/example/site.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'data') diff --git a/data/example/site.hs b/data/example/site.hs index 2488cc8..9e103bf 100644 --- a/data/example/site.hs +++ b/data/example/site.hs @@ -1,7 +1,6 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} -import Control.Applicative ((<$>)) -import Data.Monoid (mappend) +import Data.Monoid (mappend) import Hakyll @@ -46,7 +45,8 @@ main = hakyll $ do match "index.html" $ do route idRoute compile $ do - let indexCtx = field "posts" $ \_ -> postList (take 3 . recentFirst) + let indexCtx = field "posts" $ \_ -> + postList $ fmap (take 3) . recentFirst getResourceBody >>= applyAsTemplate indexCtx @@ -64,9 +64,9 @@ postCtx = -------------------------------------------------------------------------------- -postList :: ([Item String] -> [Item String]) -> Compiler String +postList :: ([Item String] -> Compiler [Item String]) -> Compiler String postList sortFilter = do - posts <- sortFilter <$> loadAll "posts/*" + posts <- sortFilter =<< loadAll "posts/*" itemTpl <- loadBody "templates/post-item.html" list <- applyTemplateList itemTpl postCtx posts return list -- cgit v1.2.3