diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-04-22 17:17:31 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-04-24 08:43:24 +0100 |
commit | 134b722349b83c746f8f52f2dbd99b89d23b644c (patch) | |
tree | a40994f61ccea48d706088a7158daf1dc104cf90 /compiler | |
parent | 68a1e679f0b97db99c552c3dbf69e651291826fa (diff) | |
download | haskell-134b722349b83c746f8f52f2dbd99b89d23b644c.tar.gz |
Be less verbose when printing Names when we don't know what's in scope
Previously we always printed qualified names, but that makes a lot of debug or
warning output very verbose. So now we only print qualified names with -dppr-debug.
Civilised output (from pukka error messages, with the environment available) is
unaffected
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/stranal/WwLib.lhs | 2 | ||||
-rw-r--r-- | compiler/utils/Outputable.lhs | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/compiler/stranal/WwLib.lhs b/compiler/stranal/WwLib.lhs index 68292839ed..4610b58734 100644 --- a/compiler/stranal/WwLib.lhs +++ b/compiler/stranal/WwLib.lhs @@ -732,7 +732,7 @@ mk_absent_let dflags arg where arg_ty = idType arg abs_rhs = mkRuntimeErrorApp aBSENT_ERROR_ID arg_ty msg - msg = showSDocDebug dflags (ppr arg <+> ppr (idType arg)) + msg = showSDoc dflags (ppr arg <+> ppr (idType arg)) mk_seq_case :: Id -> CoreExpr -> CoreExpr mk_seq_case arg body = Case (Var arg) (sanitiseCaseBndr arg) (exprType body) [(DEFAULT, [], body)] diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index e8d9347767..85d3d03557 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -190,31 +190,30 @@ neverQualify = (neverQualifyNames, neverQualifyModules) defaultUserStyle, defaultDumpStyle :: PprStyle -defaultUserStyle = mkUserStyle alwaysQualify AllTheWay +defaultUserStyle = mkUserStyle neverQualify AllTheWay + -- Print without qualifiers to reduce verbosity, unless -dppr-debug defaultDumpStyle | opt_PprStyle_Debug = PprDebug | otherwise = PprDump +defaultErrStyle :: DynFlags -> PprStyle +-- Default style for error messages, when we don't know PrintUnqualified +-- It's a bit of a hack because it doesn't take into account what's in scope +-- Only used for desugarer warnings, and typechecker errors in interface sigs +-- NB that -dppr-debug will still get into PprDebug style +defaultErrStyle dflags = mkErrStyle dflags neverQualify + -- | Style for printing error messages mkErrStyle :: DynFlags -> PrintUnqualified -> PprStyle mkErrStyle dflags qual = mkUserStyle qual (PartWay (pprUserLength dflags)) -defaultErrStyle :: DynFlags -> PprStyle --- Default style for error messages --- It's a bit of a hack because it doesn't take into account what's in scope --- Only used for desugarer warnings, and typechecker errors in interface sigs -defaultErrStyle dflags = mkUserStyle alwaysQualify depth - where depth = if opt_PprStyle_Debug - then AllTheWay - else PartWay (pprUserLength dflags) +cmdlineParserStyle :: PprStyle +cmdlineParserStyle = mkUserStyle alwaysQualify AllTheWay mkUserStyle :: PrintUnqualified -> Depth -> PprStyle mkUserStyle unqual depth | opt_PprStyle_Debug = PprDebug | otherwise = PprUser unqual depth - -cmdlineParserStyle :: PprStyle -cmdlineParserStyle = PprUser alwaysQualify AllTheWay \end{code} Orthogonal to the above printing styles are (possibly) some @@ -979,7 +978,7 @@ assertPprPanic file line msg pprDebugAndThen :: DynFlags -> (String -> a) -> String -> SDoc -> a pprDebugAndThen dflags cont heading pretty_msg - = cont (showSDocDebug dflags doc) + = cont (showSDoc dflags doc) where doc = sep [text heading, nest 4 pretty_msg] \end{code} |