summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.lhs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-06-14 16:20:06 +0100
committerIan Lynagh <igloo@earth.li>2012-06-14 16:20:06 +0100
commit46c184e101092c53e9675bcfcb90cf06e513368d (patch)
tree0693a2cd2ee06773587e743f46c2fac51c52b42a /compiler/utils/Outputable.lhs
parent0f3d8ab9f8c174f9aba5764a6b1edaf2c873b8c6 (diff)
downloadhaskell-46c184e101092c53e9675bcfcb90cf06e513368d.tar.gz
Change -dppr-user-length from a static to a dynamic flag
Diffstat (limited to 'compiler/utils/Outputable.lhs')
-rw-r--r--compiler/utils/Outputable.lhs16
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs
index 7774405583..b2ad099009 100644
--- a/compiler/utils/Outputable.lhs
+++ b/compiler/utils/Outputable.lhs
@@ -71,7 +71,8 @@ module Outputable (
pprDebugAndThen,
) where
-import {-# SOURCE #-} DynFlags( DynFlags, tracingDynFlags, targetPlatform )
+import {-# SOURCE #-} DynFlags( DynFlags, tracingDynFlags,
+ targetPlatform, pprUserLength )
import {-# SOURCE #-} Module( Module, ModuleName, moduleName )
import {-# SOURCE #-} Name( Name, nameModule )
@@ -195,16 +196,17 @@ defaultDumpStyle | opt_PprStyle_Debug = PprDebug
| otherwise = PprDump
-- | Style for printing error messages
-mkErrStyle :: PrintUnqualified -> PprStyle
-mkErrStyle qual = mkUserStyle qual (PartWay opt_PprUserLength)
+mkErrStyle :: DynFlags -> PrintUnqualified -> PprStyle
+mkErrStyle dflags qual = mkUserStyle qual (PartWay (pprUserLength dflags))
-defaultErrStyle :: PprStyle
+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
- | opt_PprStyle_Debug = mkUserStyle alwaysQualify AllTheWay
- | otherwise = mkUserStyle alwaysQualify (PartWay opt_PprUserLength)
+defaultErrStyle dflags = mkUserStyle alwaysQualify depth
+ where depth = if opt_PprStyle_Debug
+ then AllTheWay
+ else PartWay (pprUserLength dflags)
mkUserStyle :: PrintUnqualified -> Depth -> PprStyle
mkUserStyle unqual depth