aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
index 6e195dba..bab5ba0a 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -63,7 +63,9 @@ chunk str@(c:_)
chunk str
| "--" `isPrefixOf` str = chunk' $ spanToNewline str
| "{-" `isPrefixOf` str = chunk' $ chunkComment 0 str
- | otherwise = chunk' $ head $ lex str
+ | otherwise = case lex str of
+ (tok:_) -> chunk' tok
+ [] -> [str]
where
chunk' (c, rest) = c:(chunk rest)