[commit: ghc] wip/T10613: Pretty print reasons for Many (8bc7393)

git at git.haskell.org git at git.haskell.org
Thu Jul 7 15:40:56 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T10613
Link       : http://ghc.haskell.org/trac/ghc/changeset/8bc7393a6b2630b76096238f1c2622697367d8a9/ghc

>---------------------------------------------------------------

commit 8bc7393a6b2630b76096238f1c2622697367d8a9
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Jul 6 15:44:07 2016 +0200

    Pretty print reasons for Many


>---------------------------------------------------------------

8bc7393a6b2630b76096238f1c2622697367d8a9
 compiler/basicTypes/Demand.hs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs
index c8d42b0..03be236 100644
--- a/compiler/basicTypes/Demand.hs
+++ b/compiler/basicTypes/Demand.hs
@@ -377,8 +377,7 @@ data Count = One | Many ManyReasons
 -- Pretty-printing
 instance Outputable ArgUse where
   ppr Abs              = char 'A'
-  ppr (Use (Many _) a) = ppr a
-  ppr (Use One  a)     = char '1' <> char '*' <> ppr a
+  ppr (Use c  a)       = ppr c <> char '*' <> ppr a
 
 instance Outputable UseDmd where
   ppr Used           = char 'U'
@@ -388,7 +387,7 @@ instance Outputable UseDmd where
 
 instance Outputable Count where
   ppr One  = char '1'
-  ppr (Many _) = text ""
+  ppr (Many mr) = text "ω" <> parens (hcat (punctuate (char ',') (map text mr)))
 
 useBot, useTop :: ArgUse
 useBot     = Abs
@@ -761,7 +760,7 @@ oneifyDmd jd                            = jd
 
 isTopDmd :: Demand -> Bool
 -- Used to suppress pretty-printing of an uninformative demand
-isTopDmd (JD {sd = Lazy, ud = Use (Many _) Used}) = True
+isTopDmd (JD {sd = Lazy, ud = Use (Many _) Used}) = False -- True
 isTopDmd _                                        = False
 
 isAbsDmd :: Demand -> Bool



More information about the ghc-commits mailing list