Add -dppr-colsN to set width of dumps
authorBen Lippmeier <benl@ouroborus.net>
Wed, 8 Dec 2010 07:02:45 +0000 (07:02 +0000)
committerBen Lippmeier <benl@ouroborus.net>
Wed, 8 Dec 2010 07:02:45 +0000 (07:02 +0000)
compiler/main/StaticFlagParser.hs
compiler/main/StaticFlags.hs
compiler/utils/Pretty.lhs

index c582626..803baba 100644 (file)
@@ -122,6 +122,7 @@ static_flags = [
 
         ------ Debugging ----------------------------------------------------
   , Flag "dppr-debug"                  (PassFlag addOpt)
+  , Flag "dppr-cols"                   (AnySuffix addOpt)
   , Flag "dppr-user-length"            (AnySuffix addOpt)
   , Flag "dppr-case-as-let"            (PassFlag addOpt)
   , Flag "dsuppress-all"               (PassFlag addOpt)
index 8802064..e03d681 100644 (file)
@@ -21,6 +21,7 @@ module StaticFlags (
 
        -- Output style options
        opt_PprUserLength,
+       opt_PprCols,
        opt_PprCaseAsLet,
        opt_PprStyle_Debug, opt_TraceLevel,
         opt_NoDebugOutput,
@@ -233,8 +234,12 @@ opt_SuppressTypeSignatures
 
 -- | Display case expressions with a single alternative as strict let bindings
 opt_PprCaseAsLet :: Bool
-opt_PprCaseAsLet
-       = lookUp   (fsLit "-dppr-case-as-let")
+opt_PprCaseAsLet               = lookUp   (fsLit "-dppr-case-as-let")
+
+-- | Set the maximum width of the dumps
+opt_PprCols :: Int
+opt_PprCols                    = lookup_def_int "-dppr-cols" 100
+
 
 opt_PprStyle_Debug  :: Bool
 opt_PprStyle_Debug              = lookUp  (fsLit "-dppr-debug")
index 317022d..a518c0b 100644 (file)
@@ -185,7 +185,7 @@ import BufWrite
 import FastString
 import FastTypes
 import Panic
-
+import StaticFlags
 import Numeric (fromRat)
 import System.IO
 --import Foreign.Ptr (castPtr)
@@ -999,7 +999,7 @@ spaces n | n <=# _ILIT(0) = ""
 
 \begin{code}
 pprCols :: Int
-pprCols = 100 -- could make configurable
+pprCols = opt_PprCols
 
 printDoc :: Mode -> Handle -> Doc -> IO ()
 printDoc LeftMode hdl doc