aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJulien Cretel <j.cretel@umail.ucc.ie>2015-04-07 13:46:14 +0100
committerJulien Cretel <j.cretel@umail.ucc.ie>2015-04-07 13:46:32 +0100
commitb28c846018996aefb9128b2c5a7ad7d0975e1f05 (patch)
treee4e04cf526647900a280c0dde73930d5b513786f /src/Text/Pandoc
parentb29a8a5516ea36f143e3cb8db44e22630e3adb6b (diff)
downloadpandoc-b28c846018996aefb9128b2c5a7ad7d0975e1f05.tar.gz
Markdown Reader: eliminate common subexpressions
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 369c889d1..ccda83576 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1078,7 +1078,9 @@ dashedLine :: Monad m => Char
dashedLine ch = do
dashes <- many1 (char ch)
sp <- many spaceChar
- return (length dashes, length $ dashes ++ sp)
+ let lengthDashes = length dashes
+ lengthSp = length sp
+ return (lengthDashes, lengthDashes + lengthSp)
-- Parse a table header with dashed lines of '-' preceded by
-- one (or zero) line of text.
@@ -1231,7 +1233,8 @@ gridPart :: Monad m => Char -> ParserT [Char] st m (Int, Int)
gridPart ch = do
dashes <- many1 (char ch)
char '+'
- return (length dashes, length dashes + 1)
+ let lengthDashes = length dashes
+ return (lengthDashes, lengthDashes + 1)
gridDashedLines :: Monad m => Char -> ParserT [Char] st m [(Int,Int)]
gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) <* blankline