summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2020-04-13 16:29:44 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2020-04-23 17:21:28 +0300
commite21f3023b095d9bbd000330b56aaaa2977134335 (patch)
treee4f66eb46539c3d62b47648297915d19d8105f6a /compiler/GHC/Iface
parent8ea37b01b6ab16937f7b528b6bbae9fade9f1361 (diff)
downloadhaskell-wip/semigroup-sdoc.tar.gz
Use Semigroup's (<>) for Doc/SDocwip/semigroup-sdoc
Before this patch, Outputable.hs defined its own (<>) which caused conflicts with (Data.Semigroup.<>) and thus led to inconvenience. However, replacing it is not trivial due to a different fixity: http://www.haskell.org/pipermail/libraries/2011-November/017066.html Nevertheless, it is possible to update the pretty-printing code to work with (<>) of a different fixitiy, and that's what this patch implements. Now Doc and SDoc are instances of Semigroup.
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r--compiler/GHC/Iface/Ext/Types.hs10
-rw-r--r--compiler/GHC/Iface/Recomp.hs4
2 files changed, 4 insertions, 10 deletions
diff --git a/compiler/GHC/Iface/Ext/Types.hs b/compiler/GHC/Iface/Ext/Types.hs
index edd6540e80..a859188257 100644
--- a/compiler/GHC/Iface/Ext/Types.hs
+++ b/compiler/GHC/Iface/Ext/Types.hs
@@ -20,17 +20,15 @@ import FastString ( FastString )
import GHC.Iface.Type
import GHC.Types.Module ( ModuleName, Module )
import GHC.Types.Name ( Name )
-import Outputable hiding ( (<>) )
+import Outputable
import GHC.Types.SrcLoc ( RealSrcSpan )
import GHC.Types.Avail
-import qualified Outputable as O ( (<>) )
import qualified Data.Array as A
import qualified Data.Map as M
import qualified Data.Set as S
import Data.ByteString ( ByteString )
import Data.Data ( Typeable, Data )
-import Data.Semigroup ( Semigroup(..) )
import Data.Word ( Word8 )
import Control.Applicative ( (<|>) )
@@ -217,7 +215,7 @@ instance Outputable a => Outputable (HieASTs a) where
ppr (HieASTs asts) = M.foldrWithKey go "" asts
where
go k a rest = vcat $
- [ "File: " O.<> ppr k
+ [ "File: " <> ppr k
, ppr a
, rest
]
@@ -244,7 +242,7 @@ instance Binary (HieAST TypeIndex) where
instance Outputable a => Outputable (HieAST a) where
ppr (Node ni sp ch) = hang header 2 rest
where
- header = text "Node@" O.<> ppr sp O.<> ":" <+> ppr ni
+ header = text "Node@" <> ppr sp <> ":" <+> ppr ni
rest = vcat (map ppr ch)
-- | The information stored in one AST node.
@@ -569,7 +567,7 @@ instance Outputable TyVarScope where
ppr (ResolvedScopes xs) =
text "type variable scopes:" <+> hsep (punctuate ", " $ map ppr xs)
ppr (UnresolvedScope ns sp) =
- text "unresolved type variable scope for name" O.<> plural ns
+ text "unresolved type variable scope for" <+> plural "name" ns
<+> pprBindSpan sp
instance Binary TyVarScope where
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs
index 57809a6d59..a1f7e6d0ee 100644
--- a/compiler/GHC/Iface/Recomp.hs
+++ b/compiler/GHC/Iface/Recomp.hs
@@ -49,10 +49,6 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import GHC.Driver.Plugins ( PluginRecompile(..), PluginWithArgs(..), pluginRecompile', plugins )
---Qualified import so we can define a Semigroup instance
--- but it doesn't clash with Outputable.<>
-import qualified Data.Semigroup
-
{-
-----------------------------------------------
Recompilation checking