diff options
Diffstat (limited to 'src/Text/Hakyll/Util.hs')
-rw-r--r-- | src/Text/Hakyll/Util.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs index dd84d73..50a36e6 100644 --- a/src/Text/Hakyll/Util.hs +++ b/src/Text/Hakyll/Util.hs @@ -1,11 +1,13 @@ module Text.Hakyll.Util ( makeDirectories, - getRecursiveContents + getRecursiveContents, + trim ) where import System.Directory import System.FilePath import Control.Monad +import Data.Char -- | Given a path to a file, try to make the path writable by making -- all directories on the path. @@ -27,3 +29,8 @@ getRecursiveContents topdir = do else return [path] return (concat paths) where isProper = not . (== '.') . head + +-- | Trim a string (drop spaces and tabs at both sides). +trim :: String -> String +trim = reverse . trim' . reverse . trim' + where trim' = dropWhile isSpace |