From 4bc34b8a98ffa1e7f3478a596b73c4ab12d9cb1b Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Thu, 14 Jan 2010 20:46:08 +0100 Subject: Added ReaderT to our stack. --- src/Text/Hakyll/File.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Text/Hakyll/File.hs') diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index 0ed91d5..3dd2538 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -17,6 +17,8 @@ import System.Directory import System.FilePath import Control.Monad import Data.List (isPrefixOf) +import Text.Hakyll.Hakyll (Hakyll) +import Control.Monad.Reader (liftIO) -- | Auxiliary function to remove pathSeparators form the start. We don't deal -- with absolute paths here. We also remove $root from the start. @@ -90,8 +92,10 @@ havingExtension :: String -> [FilePath] -> [FilePath] havingExtension extension = filter ((==) extension . takeExtension) -- | Perform an IO action on every file in a given directory. -directory :: (FilePath -> IO ()) -> FilePath -> IO () -directory action dir = getRecursiveContents dir >>= mapM_ action +directory :: (FilePath -> Hakyll ()) -> FilePath -> Hakyll () +directory action dir = do + contents <- liftIO $ getRecursiveContents dir + mapM_ action contents -- | Check if a cache file is still valid. isCacheValid :: FilePath -> [FilePath] -> IO Bool -- cgit v1.2.3