summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-10-02 11:54:47 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-10-02 11:54:47 +0200
commitcd246971582639666bb1afe1b51bbd3db1ac744a (patch)
tree4c3831af0c2cf7f948f806c7c839b23d788793a1
parent6dea5cbd404b9f01946585b2ca0269d771a6eab7 (diff)
downloadhakyll-cd246971582639666bb1afe1b51bbd3db1ac744a.tar.gz
Disable partial functions (thanks chrisdone)
-rw-r--r--src/Text/Hakyll/File.hs2
-rw-r--r--src/Text/Hakyll/Internal/CompressCss.hs4
-rw-r--r--src/Text/Hakyll/Internal/Page.hs6
-rw-r--r--src/Text/Hakyll/Internal/Template.hs6
-rw-r--r--src/Text/Hakyll/Util.hs6
5 files changed, 9 insertions, 15 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs
index 15903c7..57571e4 100644
--- a/src/Text/Hakyll/File.hs
+++ b/src/Text/Hakyll/File.hs
@@ -34,7 +34,7 @@ import Text.Hakyll.Internal.FileType (isRenderableFile)
removeLeadingSeparator :: FilePath -> FilePath
removeLeadingSeparator [] = []
removeLeadingSeparator path
- | head path' `elem` pathSeparators = tail path'
+ | head path' `elem` pathSeparators = drop 1 path'
| otherwise = path'
where
path' = if "$root" `isPrefixOf` path then drop 5 path
diff --git a/src/Text/Hakyll/Internal/CompressCss.hs b/src/Text/Hakyll/Internal/CompressCss.hs
index 4b19984..4a78791 100644
--- a/src/Text/Hakyll/Internal/CompressCss.hs
+++ b/src/Text/Hakyll/Internal/CompressCss.hs
@@ -29,8 +29,8 @@ stripComments :: String -> String
stripComments [] = []
stripComments str
| isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str
- | otherwise = head str : stripComments (tail str)
+ | otherwise = head str : stripComments (drop 1 str)
where
eatComments str' | null str' = []
| isPrefixOf "*/" str' = drop 2 str'
- | otherwise = eatComments $ tail str'
+ | otherwise = eatComments $ drop 1 str'
diff --git a/src/Text/Hakyll/Internal/Page.hs b/src/Text/Hakyll/Internal/Page.hs
index 59bae65..92fb4fc 100644
--- a/src/Text/Hakyll/Internal/Page.hs
+++ b/src/Text/Hakyll/Internal/Page.hs
@@ -71,8 +71,8 @@ readSection _ _ [] = []
readSection renderFunction isFirst ls
| not isDelimiter' = body ls
| isNamedDelimiter = readSectionMetaData ls
- | isFirst = readSimpleMetaData (tail ls)
- | otherwise = body (tail ls)
+ | isFirst = readSimpleMetaData (drop 1 ls)
+ | otherwise = body (drop 1 ls)
where
isDelimiter' = isPossibleDelimiter (head ls)
isNamedDelimiter = head ls `matchesRegex` "^----* *[a-zA-Z0-9][a-zA-Z0-9]*"
@@ -80,7 +80,7 @@ readSection renderFunction isFirst ls
readSimpleMetaData = map readPair . filter (not . all isSpace)
readPair = trimPair . break (== ':')
- trimPair (key, value) = (trim key, trim $ tail value)
+ trimPair (key, value) = (trim key, trim $ drop 1 value)
readSectionMetaData [] = []
readSectionMetaData (header:value) =
diff --git a/src/Text/Hakyll/Internal/Template.hs b/src/Text/Hakyll/Internal/Template.hs
index bd9121b..15a2c8c 100644
--- a/src/Text/Hakyll/Internal/Template.hs
+++ b/src/Text/Hakyll/Internal/Template.hs
@@ -29,15 +29,13 @@ fromString = Template . fromString'
fromString' [] = []
fromString' string
| "$$" `isPrefixOf` string =
- EscapeCharacter : (fromString' $ tail tail')
+ EscapeCharacter : (fromString' $ drop 2 string)
| "$" `isPrefixOf` string =
- let (key, rest) = span isAlphaNum tail'
+ let (key, rest) = span isAlphaNum $ drop 1 string
in Identifier key : fromString' rest
| otherwise =
let (chunk, rest) = break (== '$') string
in Chunk chunk : fromString' rest
- where
- tail' = tail string
-- | Read a @Template@ from a file. This function might fetch the @Template@
-- from the cache, if available.
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs
index 84d6257..e032c52 100644
--- a/src/Text/Hakyll/Util.hs
+++ b/src/Text/Hakyll/Util.hs
@@ -22,11 +22,7 @@ stripHtml :: String -> String
stripHtml [] = []
stripHtml str = let (beforeTag, rest) = break (== '<') str
(_, afterTag) = break (== '>') rest
- in beforeTag ++ stripHtml (tail' afterTag)
- where
- -- We need a failsafe tail function.
- tail' [] = []
- tail' xs = tail xs
+ in beforeTag ++ stripHtml (drop 1 afterTag)
-- | Make a HTML link.
--