aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hoogle.hs
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-03-27 03:04:21 +0000
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-03-27 03:04:21 +0000
commite49d473bf33fa374c60462ad178ac539f026c3ff (patch)
tree23f7070067f947618ba91150cfec8fdc1096d5db /haddock-api/src/Haddock/Backends/Hoogle.hs
parent1a65ec54ce8516dc2d09af3b1d20fedd21e64ad6 (diff)
Don't print instance safety information in Hoogle
Fixes #168
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hoogle.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Hoogle.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index 12dfc1f5..914e3466 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -15,7 +15,8 @@ module Haddock.Backends.Hoogle (
ppHoogle
) where
-
+import BasicTypes (OverlapFlag(..), OverlapMode(..))
+import InstEnv (ClsInst(..))
import Haddock.GhcUtils
import Haddock.Types hiding (Version)
import Haddock.Utils hiding (out)
@@ -169,7 +170,15 @@ ppClass dflags x subdocs = out dflags x{tcdSigs=[]} :
ppInstance :: DynFlags -> ClsInst -> [String]
ppInstance dflags x =
- [dropComment $ outWith (showSDocForUser dflags alwaysQualify) x]
+ [dropComment $ outWith (showSDocForUser dflags alwaysQualify) cls]
+ where
+ -- As per #168, we don't want safety information about the class
+ -- in Hoogle output. The easiest way to achieve this is to set the
+ -- safety information to a state where the Outputable instance
+ -- produces no output which means no overlap and unsafe (or [safe]
+ -- is generated).
+ cls = x { is_flag = OverlapFlag { overlapMode = NoOverlap mempty
+ , isSafeOverlap = False } }
ppSynonym :: DynFlags -> TyClDecl Name -> [String]
ppSynonym dflags x = [out dflags x]