aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-08 15:05:35 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:48 +0200
commitfab61bb80c2d8059e91aece7677cf349cd34a8db (patch)
treecea4b0a08ed3ff07b66da40eff3ab5728feadac2 /haddock-api/src/Haddock
parentc84a3ef8ebca5fb396ee9dc8cb2654f7891f5c0e (diff)
Fix span matching to allow parenthesized operators hyperlinking.
Diffstat (limited to 'haddock-api/src/Haddock')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
index 2325aa21..05d6a52e 100644
--- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs
@@ -101,10 +101,10 @@ imports =
matches :: Span -> GHC.SrcSpan -> Bool
matches tspan (GHC.RealSrcSpan aspan)
- | rs && cs && re && ce = True
+ | saspan <= stspan && etspan <= easpan = True
where
- rs = (posRow . spStart) tspan == GHC.srcSpanStartLine aspan
- cs = (posCol . spStart) tspan == GHC.srcSpanStartCol aspan
- re = (posRow . spEnd) tspan == GHC.srcSpanEndLine aspan
- ce = (posCol . spEnd) tspan == GHC.srcSpanEndCol aspan
+ stspan = (posRow . spStart $ tspan, posCol . spStart $ tspan)
+ etspan = (posRow . spEnd $ tspan, posCol . spEnd $ tspan)
+ saspan = (GHC.srcSpanStartLine aspan, GHC.srcSpanStartCol aspan)
+ easpan = (GHC.srcSpanEndLine aspan, GHC.srcSpanEndCol aspan)
matches _ _ = False