New flag -dsuppress-coercions to avoid printing coercions in Core dumps
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Wed, 14 Oct 2009 00:30:58 +0000 (00:30 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Wed, 14 Oct 2009 00:30:58 +0000 (00:30 +0000)
compiler/coreSyn/PprCore.lhs
compiler/main/StaticFlagParser.hs
compiler/main/StaticFlags.hs
docs/users_guide/debugging.xml
docs/users_guide/flags.xml

index e210937..3b829f7 100644 (file)
@@ -27,6 +27,7 @@ import DataCon
 import TyCon
 import Type
 import Coercion
+import StaticFlags
 import BasicTypes
 import Util
 import Outputable
@@ -114,9 +115,11 @@ ppr_expr _       (Lit lit)  = ppr lit
 ppr_expr add_par (Cast expr co) 
   = add_par $
     sep [pprParendExpr expr, 
-        ptext (sLit "`cast`") <+> parens (pprCo co)]
+        ptext (sLit "`cast`") <+> pprCo co]
   where
-    pprCo co = sep [ppr co, dcolon <+> ppr (coercionKindPredTy co)]
+    pprCo co | opt_SuppressCoercions = ptext (sLit "...")
+             | otherwise = parens
+                         $ sep [ppr co, dcolon <+> ppr (coercionKindPredTy co)]
         
 
 ppr_expr add_par expr@(Lam _ _)
index bcc96a6..966b6ec 100644 (file)
@@ -120,6 +120,7 @@ static_flags = [
         ------ Debugging ----------------------------------------------------
   , Flag "dppr-debug"        (PassFlag addOpt) Supported
   , Flag "dsuppress-uniques" (PassFlag addOpt) Supported
+  , Flag "dsuppress-coercions" (PassFlag addOpt) Supported
   , Flag "dppr-user-length"  (AnySuffix addOpt) Supported
   , Flag "dopt-fuel"         (AnySuffix addOpt) Supported
   , Flag "dno-debug-output"  (PassFlag addOpt) Supported
index 8035211..2d3b3ad 100644 (file)
@@ -22,6 +22,7 @@ module StaticFlags (
        -- Output style options
        opt_PprUserLength,
        opt_SuppressUniques,
+        opt_SuppressCoercions,
        opt_PprStyle_Debug,
         opt_NoDebugOutput,
 
@@ -182,6 +183,8 @@ opt_IgnoreDotGhci           = lookUp (fsLit "-ignore-dot-ghci")
 -- debugging opts
 opt_SuppressUniques :: Bool
 opt_SuppressUniques            = lookUp  (fsLit "-dsuppress-uniques")
+opt_SuppressCoercions :: Bool
+opt_SuppressCoercions           = lookUp  (fsLit "-dsuppress-coercions")
 opt_PprStyle_Debug  :: Bool
 opt_PprStyle_Debug             = lookUp  (fsLit "-dppr-debug")
 opt_PprUserLength   :: Int
index d6a520a..d1e9e16 100644 (file)
 
       <varlistentry>
        <term>
+          <option>-dsuppress-coercions</option>
+          <indexterm><primary><option>-dsuppress-coercions</option></primary></indexterm>
+        </term>
+       <listitem>
+          <para>Suppress the printing of coercions in Core dumps to make them
+shorter.</para>
+       </listitem>
+      </varlistentry>
+
+      <varlistentry>
+       <term>
           <option>-dppr-user-length</option>
           <indexterm><primary><option>-dppr-user-length</option></primary></indexterm>
         </term>
index aae0f59..afec9bd 100644 (file)
              <entry>-</entry>
            </row>
            <row>
+             <entry><option>-dsuppress-coercions</option></entry>
+             <entry>Suppress the printing of coercions in Core dumps to make them shorter.</entry>
+             <entry>static</entry>
+             <entry>-</entry>
+           </row>
+           <row>
              <entry><option>-dppr-noprags</option></entry>
              <entry>Don't output pragma info in dumps</entry>
              <entry>static</entry>