The problem is that showing SDoc's looks at the static flags global
variables, but those are panics while we are parsing the static flags.
We work around this by explicitly using a fixed prettyprinter style.
errorsToGhcException :: [Located String] -> GhcException
errorsToGhcException errs =
let errors = vcat [ ppr l <> text ": " <> text e | L l e <- errs ]
errorsToGhcException :: [Located String] -> GhcException
errorsToGhcException errs =
let errors = vcat [ ppr l <> text ": " <> text e | L l e <- errs ]
- in UsageError (showSDoc errors)
+ in UsageError (showSDoc $ withPprStyle cmdlineParserStyle errors)
codeStyle, userStyle, debugStyle, dumpStyle, asmStyle,
ifPprDebug, qualName, qualModule,
mkErrStyle, defaultErrStyle, defaultDumpStyle, defaultUserStyle,
codeStyle, userStyle, debugStyle, dumpStyle, asmStyle,
ifPprDebug, qualName, qualModule,
mkErrStyle, defaultErrStyle, defaultDumpStyle, defaultUserStyle,
- mkUserStyle, Depth(..),
+ mkUserStyle, cmdlineParserStyle, Depth(..),
-- * Error handling and debugging utilities
pprPanic, assertPprPanic, pprPanicFastInt, pprPgmError,
-- * Error handling and debugging utilities
pprPanic, assertPprPanic, pprPanicFastInt, pprPgmError,
mkUserStyle unqual depth
| opt_PprStyle_Debug = PprDebug
| otherwise = PprUser unqual depth
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
\end{code}
Orthogonal to the above printing styles are (possibly) some