@@ -1,7 +1,6 @@
11--------------------------------------------------------------------------------
22{-# LANGUAGE OverloadedStrings #-}
3−import Control.Applicative ((<$>))
4−import Data.Monoid (mappend)
3+import Data.Monoid (mappend)
54import Hakyll
65
76
@@ -46,7 +45,8 @@ main = hakyll $ do
4645 match "index.html" $ do
4746 route idRoute
4847 compile $ do
49− let indexCtx = field "posts" $ \_ -> postList (take 3 . recentFirst)
48+ let indexCtx = field "posts" $ \_ ->
49+ postList $ fmap (take 3) . recentFirst
5050
5151 getResourceBody
5252 >>= applyAsTemplate indexCtx
@@ -64,9 +64,9 @@ postCtx =
6464
6565
6666--------------------------------------------------------------------------------
67−postList :: ([Item String] -> [Item String]) -> Compiler String
67+postList :: ([Item String] -> Compiler [Item String]) -> Compiler String
6868postList sortFilter = do
69− posts <- sortFilter <$> loadAll "posts/*"
69+ posts <- sortFilter =<< loadAll "posts/*"
7070 itemTpl <- loadBody "templates/post-item.html"
7171 list <- applyTemplateList itemTpl postCtx posts
7272 return list