[commit: ghc] master: Add an Outputable instance for ListMap (746ab0b)

git at git.haskell.org git at git.haskell.org
Wed Jul 26 11:34:08 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/746ab0b4a2f97d9f2a97fc28431e5bdfbc10b8cf/ghc

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

commit 746ab0b4a2f97d9f2a97fc28431e5bdfbc10b8cf
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jul 26 08:31:47 2017 +0100

    Add an Outputable instance for ListMap


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

746ab0b4a2f97d9f2a97fc28431e5bdfbc10b8cf
 compiler/coreSyn/TrieMap.hs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compiler/coreSyn/TrieMap.hs b/compiler/coreSyn/TrieMap.hs
index a6b9db4..fcff256 100644
--- a/compiler/coreSyn/TrieMap.hs
+++ b/compiler/coreSyn/TrieMap.hs
@@ -278,6 +278,9 @@ instance TrieMap m => TrieMap (ListMap m) where
    foldTM   = fdList
    mapTM    = mapList
 
+instance (TrieMap m, Outputable a) => Outputable (ListMap m a) where
+  ppr m = text "List elts" <+> ppr (foldTM (:) m [])
+
 mapList :: TrieMap m => (a->b) -> ListMap m a -> ListMap m b
 mapList f (LM { lm_nil = mnil, lm_cons = mcons })
   = LM { lm_nil = fmap f mnil, lm_cons = mapTM (mapTM f) mcons }



More information about the ghc-commits mailing list