summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Regex.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-19 14:08:19 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-19 14:08:19 +0100
commitf5a6c4974d561e05b2882d38b54b45188ee31185 (patch)
tree4be6d29872ef395c2bbbc1550021abb88eddf979 /src/Text/Hakyll/Regex.hs
parente9dd4c75a21ee9bc8f42ea725d071974127a97d1 (diff)
downloadhakyll-f5a6c4974d561e05b2882d38b54b45188ee31185.tar.gz
Hakyll now passes HLint.
Diffstat (limited to 'src/Text/Hakyll/Regex.hs')
-rw-r--r--src/Text/Hakyll/Regex.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Hakyll/Regex.hs b/src/Text/Hakyll/Regex.hs
index 9b7177e..8706f99 100644
--- a/src/Text/Hakyll/Regex.hs
+++ b/src/Text/Hakyll/Regex.hs
@@ -12,7 +12,7 @@ import Text.Regex.TDFA
-- | Match a regular expression against a string, returning more information
-- about the match.
matchRegexAll :: Regex -> String -> Maybe (String, String, String, [String])
-matchRegexAll p str = matchM p str
+matchRegexAll = matchM
-- | Replaces every occurance of the given regexp with the replacement string.
subRegex :: Regex -- ^ Search pattern
@@ -30,10 +30,10 @@ subRegex regexp inp replacement =
Nothing -> repl
Just (lead, _, trail, bgroups) ->
let newval =
- if (head bgroups) == "\\"
+ if head bgroups == "\\"
then "\\"
else let index :: Int
- index = (read (head bgroups)) - 1
+ index = read (head bgroups) - 1
in if index == -1
then match'
else groups !! index
@@ -41,7 +41,7 @@ subRegex regexp inp replacement =
in case matchRegexAll regexp inp of
Nothing -> inp
Just (lead, match', trail, groups) ->
- lead ++ lookup' match' replacement groups ++ (subRegex regexp trail replacement)
+ lead ++ lookup' match' replacement groups ++ subRegex regexp trail replacement
-- | Splits a string based on a regular expression. The regular expression
-- should identify one delimiter.
@@ -70,5 +70,7 @@ substituteRegex pattern replacement string =
subRegex (makeRegex pattern) string replacement
-- | Simple regex matching.
-matchesRegex :: String -> String -> Bool
-matchesRegex string pattern = string =~ pattern
+matchesRegex :: String -- ^ Input string.
+ -> String -- ^ Pattern to match.
+ -> Bool
+matchesRegex = (=~)