aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hyperlinker')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
index bfee4a7f..fa5a58b3 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -82,14 +82,11 @@ tag :: [String] -> [(Span, String)]
tag =
reverse . snd . foldl aux (Position 1 1, [])
where
- aux (pos, cs) c =
- let pos' = move pos c
- in (pos', ((Span pos pos', c):cs))
- move pos str@(c:_)
- | isSpace c = foldl move' pos str
- move pos str = pos { posCol = posCol pos + length str }
- move' pos '\n' = pos { posRow = posRow pos + 1, posCol = 1 }
- move' pos _ = pos { posCol = posCol pos + 1 }
+ aux (pos, cs) str =
+ let pos' = foldl move pos str
+ in (pos', (Span pos pos', str):cs)
+ move pos '\n' = pos { posRow = posRow pos + 1, posCol = 1 }
+ move pos _ = pos { posCol = posCol pos + 1 }
tokenize :: [(Span, String)] -> [Token]
tokenize =