on master help sign in
Disable partial functions (thanks chrisdone)
commitcd246971582639666bb1afe1b51bbd3db1ac744a authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSat 2 Oct 2010, 11:54 (16 years ago) parent6dea5cb
5 files changed+9−15
src/Text/Hakyll/File.hs+1−1 src/Text/Hakyll/Internal/CompressCss.hs+2−2 src/Text/Hakyll/Internal/Page.hs+3−3 src/Text/Hakyll/Internal/Template.hs+2−4 src/Text/Hakyll/Util.hs+1−5
src/Text/Hakyll/File.hs+1−1
@@ -34,7 +34,7 @@ import Text.Hakyll.Internal.FileType (isRenderableFile)
3434removeLeadingSeparator :: FilePath -> FilePath
3535removeLeadingSeparator [] = []
3636removeLeadingSeparator path
37− | head path' `elem` pathSeparators = tail path'
37+ | head path' `elem` pathSeparators = drop 1 path'
3838 | otherwise = path'
3939 where
4040 path' = if "$root" `isPrefixOf` path then drop 5 path
src/Text/Hakyll/Internal/CompressCss.hs+2−2
@@ -29,8 +29,8 @@ stripComments :: String -> String
2929stripComments [] = []
3030stripComments str
3131 | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str
32− | otherwise = head str : stripComments (tail str)
32+ | otherwise = head str : stripComments (drop 1 str)
3333 where
3434 eatComments str' | null str' = []
3535 | isPrefixOf "*/" str' = drop 2 str'
36− | otherwise = eatComments $ tail str'
36+ | otherwise = eatComments $ drop 1 str'
src/Text/Hakyll/Internal/Page.hs+3−3
@@ -71,8 +71,8 @@ readSection _ _ [] = []
7171readSection renderFunction isFirst ls
7272 | not isDelimiter' = body ls
7373 | isNamedDelimiter = readSectionMetaData ls
74− | isFirst = readSimpleMetaData (tail ls)
75− | otherwise = body (tail ls)
74+ | isFirst = readSimpleMetaData (drop 1 ls)
75+ | otherwise = body (drop 1 ls)
7676 where
7777 isDelimiter' = isPossibleDelimiter (head ls)
7878 isNamedDelimiter = head ls `matchesRegex` "^----* *[a-zA-Z0-9][a-zA-Z0-9]*"
@@ -80,7 +80,7 @@ readSection renderFunction isFirst ls
8080
8181 readSimpleMetaData = map readPair . filter (not . all isSpace)
8282 readPair = trimPair . break (== ':')
83− trimPair (key, value) = (trim key, trim $ tail value)
83+ trimPair (key, value) = (trim key, trim $ drop 1 value)
8484
8585 readSectionMetaData [] = []
8686 readSectionMetaData (header:value) =
src/Text/Hakyll/Internal/Template.hs+2−4
@@ -29,15 +29,13 @@ fromString = Template . fromString'
2929 fromString' [] = []
3030 fromString' string
3131 | "$$" `isPrefixOf` string =
32− EscapeCharacter : (fromString' $ tail tail')
32+ EscapeCharacter : (fromString' $ drop 2 string)
3333 | "$" `isPrefixOf` string =
34− let (key, rest) = span isAlphaNum tail'
34+ let (key, rest) = span isAlphaNum $ drop 1 string
3535 in Identifier key : fromString' rest
3636 | otherwise =
3737 let (chunk, rest) = break (== '$') string
3838 in Chunk chunk : fromString' rest
39− where
40− tail' = tail string
4139
4240-- | Read a @Template@ from a file. This function might fetch the @Template@
4341-- from the cache, if available.
src/Text/Hakyll/Util.hs+1−5
@@ -22,11 +22,7 @@ stripHtml :: String -> String
2222stripHtml [] = []
2323stripHtml str = let (beforeTag, rest) = break (== '<') str
2424 (_, afterTag) = break (== '>') rest
25− in beforeTag ++ stripHtml (tail' afterTag)
26− where
27− -- We need a failsafe tail function.
28− tail' [] = []
29− tail' xs = tail xs
25+ in beforeTag ++ stripHtml (drop 1 afterTag)
3026
3127-- | Make a HTML link.
3228--