[commit: ghc] master: Sort the output of -dump-strsigs (5e0fe05)

git at git.haskell.org git at git.haskell.org
Mon Dec 9 20:06:35 UTC 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5e0fe058aeaddcfeb437670e470e024f7d90ce7c/ghc

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

commit 5e0fe058aeaddcfeb437670e470e024f7d90ce7c
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Dec 9 20:05:44 2013 +0000

    Sort the output of -dump-strsigs


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

5e0fe058aeaddcfeb437670e470e024f7d90ce7c
 compiler/stranal/DmdAnal.lhs |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index 2b4a6b1..bf88383 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -36,6 +36,8 @@ import Maybes		( isJust, orElse )
 import TysWiredIn	( unboxedPairDataCon )
 import TysPrim		( realWorldStatePrimTy )
 import ErrUtils         ( dumpIfSet_dyn )
+import Name             ( getName, stableNameCmp )
+import Data.Function    ( on )
 \end{code}
 
 %************************************************************************
@@ -1107,12 +1109,13 @@ set_idStrictness env id sig
   = setIdStrictness id (zapStrictSig (ae_dflags env) sig)
 
 dumpStrSig :: CoreProgram -> SDoc
-dumpStrSig binds = vcat (concatMap goBind binds)
+dumpStrSig binds = vcat (map printId ids)
   where
-  goBind (NonRec i _) = [ goId i ]
-  goBind (Rec bs)     = map (goId . fst) bs
-  goId id | isExportedId id = ppr id <> colon <+> pprIfaceStrictSig (idStrictness id)
-          | otherwise       = empty
+  ids = sortBy (stableNameCmp `on` getName) (concatMap getIds binds)
+  getIds (NonRec i _) = [ i ]
+  getIds (Rec bs)     = map fst bs
+  printId id | isExportedId id = ppr id <> colon <+> pprIfaceStrictSig (idStrictness id)
+             | otherwise       = empty
 
 \end{code}
 



More information about the ghc-commits mailing list