From e49d473bf33fa374c60462ad178ac539f026c3ff Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Fri, 27 Mar 2015 03:04:21 +0000 Subject: Don't print instance safety information in Hoogle Fixes #168 --- CHANGES | 2 ++ haddock-api/src/Haddock/Backends/Hoogle.hs | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 7aba49ae..af90b4fc 100644 --- a/CHANGES +++ b/CHANGES @@ -41,6 +41,8 @@ Changes in version 2.16.0 * Output method documentation in Hoogle backend (#259) + * Don't print instance safety information in Hoogle (#168) + Changes in version 2.15.0 * Always read in prologue files as UTF8 (#286 and Cabal #1721) 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] -- cgit v1.2.3