[commit: ghc] master: Make TypeMap an instance of Outputable (bed4ec5)

Simon Peyton Jones simonpj at microsoft.com
Mon Dec 5 05:49:52 CET 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/bed4ec57d92d0730ecd03c04b6bf06475ed006db

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

commit bed4ec57d92d0730ecd03c04b6bf06475ed006db
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Dec 5 04:00:34 2011 +0000

    Make TypeMap an instance of Outputable

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

 compiler/coreSyn/TrieMap.lhs |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/compiler/coreSyn/TrieMap.lhs b/compiler/coreSyn/TrieMap.lhs
index b7ee95c..d8a134e 100644
--- a/compiler/coreSyn/TrieMap.lhs
+++ b/compiler/coreSyn/TrieMap.lhs
@@ -14,7 +14,7 @@
 {-# LANGUAGE TypeFamilies #-}
 module TrieMap(
    CoreMap, emptyCoreMap, extendCoreMap, lookupCoreMap, foldCoreMap,
-   TypeMap, 
+   TypeMap, foldTypeMap, 
    CoercionMap, 
    MaybeMap, 
    ListMap,
@@ -488,6 +488,12 @@ data TypeMap a
        , tm_tc_app :: NameEnv (ListMap TypeMap a)
        , tm_forall :: TypeMap (BndrMap a) }
 
+instance Outputable a => Outputable (TypeMap a) where
+  ppr m = text "TypeMap elts" <+> ppr (foldTypeMap (:) [] m)
+
+foldTypeMap :: (a -> b -> b) -> b -> TypeMap a -> b
+foldTypeMap k z m = fdT k m z
+
 wrapEmptyTypeMap :: TypeMap a
 wrapEmptyTypeMap = TM { tm_var  = emptyTM
                       , tm_app  = EmptyTM





More information about the Cvs-ghc mailing list