summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2021-01-06 08:12:04 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-01 14:06:11 -0500
commitddc2a7595a28b6098b6aab61bc830f2296affcdc (patch)
tree2863cb09e18f9d2cba1ff8a4f78b6a2f6431837f /compiler/GHC/Tc/Gen
parent5464845a012bf174cfafe03aaeb2e47150e7efb5 (diff)
downloadhaskell-ddc2a7595a28b6098b6aab61bc830f2296affcdc.tar.gz
Remove ErrDoc and MsgDoc
This commit boldly removes the ErrDoc and the MsgDoc from the codebase. The former was introduced with the only purpose of classifying errors according to their importance, but a similar result can be obtained just by having a simple [SDoc], and placing bullets after each of them. On top of that I have taken the perhaps controversial decision to also banish MsgDoc, as it was merely a type alias over an SDoc and as such it wasn't offering any extra type safety. Granted, it was perhaps making type signatures slightly more "focused", but at the expense of cognitive burden: if it's really just an SDoc, let's call it with its proper name.
Diffstat (limited to 'compiler/GHC/Tc/Gen')
-rw-r--r--compiler/GHC/Tc/Gen/Bind.hs2
-rw-r--r--compiler/GHC/Tc/Gen/Export.hs2
-rw-r--r--compiler/GHC/Tc/Gen/Foreign.hs4
-rw-r--r--compiler/GHC/Tc/Gen/Splice.hs6
4 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Tc/Gen/Bind.hs b/compiler/GHC/Tc/Gen/Bind.hs
index 62c6cb218a..c677643be5 100644
--- a/compiler/GHC/Tc/Gen/Bind.hs
+++ b/compiler/GHC/Tc/Gen/Bind.hs
@@ -230,7 +230,7 @@ tcHsBootSigs binds sigs
-- Notice that we make GlobalIds, not LocalIds
tc_boot_sig s = pprPanic "tcHsBootSigs/tc_boot_sig" (ppr s)
-badBootDeclErr :: MsgDoc
+badBootDeclErr :: SDoc
badBootDeclErr = text "Illegal declarations in an hs-boot file"
------------------------
diff --git a/compiler/GHC/Tc/Gen/Export.hs b/compiler/GHC/Tc/Gen/Export.hs
index 4d0c8da8e3..114e339dec 100644
--- a/compiler/GHC/Tc/Gen/Export.hs
+++ b/compiler/GHC/Tc/Gen/Export.hs
@@ -814,7 +814,7 @@ failWithDcErr parent child parents = do
exportClashErr :: GlobalRdrEnv
-> GreName -> GreName
-> IE GhcPs -> IE GhcPs
- -> MsgDoc
+ -> SDoc
exportClashErr global_env child1 child2 ie1 ie2
= vcat [ text "Conflicting exports for" <+> quotes (ppr occ) <> colon
, ppr_export child1' gre1' ie1'
diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index 9818642d47..b40386e513 100644
--- a/compiler/GHC/Tc/Gen/Foreign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -542,7 +542,7 @@ checkCConv JavaScriptCallConv = do dflags <- getDynFlags
-- Warnings
-check :: Validity -> (MsgDoc -> MsgDoc) -> TcM ()
+check :: Validity -> (SDoc -> SDoc) -> TcM ()
check IsValid _ = return ()
check (NotValid doc) err_fn = addErrTc (err_fn doc)
@@ -558,7 +558,7 @@ argument, result :: SDoc
argument = text "argument"
result = text "result"
-badCName :: CLabelString -> MsgDoc
+badCName :: CLabelString -> SDoc
badCName target
= sep [quotes (ppr target) <+> text "is not a valid C identifier"]
diff --git a/compiler/GHC/Tc/Gen/Splice.hs b/compiler/GHC/Tc/Gen/Splice.hs
index e21adf31df..346000975a 100644
--- a/compiler/GHC/Tc/Gen/Splice.hs
+++ b/compiler/GHC/Tc/Gen/Splice.hs
@@ -789,7 +789,7 @@ runAnnotation target expr = do
ann_value = serialized
}
-convertAnnotationWrapper :: ForeignHValue -> TcM (Either MsgDoc Serialized)
+convertAnnotationWrapper :: ForeignHValue -> TcM (Either SDoc Serialized)
convertAnnotationWrapper fhv = do
interp <- tcGetInterp
case interp of
@@ -910,7 +910,7 @@ runMetaD = runMeta metaRequestD
---------------
runMeta' :: Bool -- Whether code should be printed in the exception message
-> (hs_syn -> SDoc) -- how to print the code
- -> (SrcSpan -> ForeignHValue -> TcM (Either MsgDoc hs_syn)) -- How to run x
+ -> (SrcSpan -> ForeignHValue -> TcM (Either SDoc hs_syn)) -- How to run x
-> LHsExpr GhcTc -- Of type x; typically x = Q TH.Exp, or
-- something like that
-> TcM hs_syn -- Of type t
@@ -1285,7 +1285,7 @@ runTH ty fhv = do
-- See Note [Remote Template Haskell] in libraries/ghci/GHCi/TH.hs.
runRemoteTH
:: IServInstance
- -> [Messages ErrDoc] -- saved from nested calls to qRecover
+ -> [Messages [SDoc]] -- saved from nested calls to qRecover
-> TcM ()
runRemoteTH iserv recovers = do
THMsg msg <- liftIO $ readIServ iserv getTHMessage