diff options
author | David Waern <davve@dtek.chalmers.se> | 2007-10-21 14:34:26 +0000 |
---|---|---|
committer | David Waern <davve@dtek.chalmers.se> | 2007-10-21 14:34:26 +0000 |
commit | 2fb84ba8be505906e73f1c84405c639646c8a30e (patch) | |
tree | 14c867939f6269351edc062a2ab7cfeb0b291935 /src/Haddock/GHC/Utils.hs | |
parent | 122bb92ffc28553b75e731639d81ce33e1cf2a28 (diff) |
Add some Outputable utils
Diffstat (limited to 'src/Haddock/GHC/Utils.hs')
-rw-r--r-- | src/Haddock/GHC/Utils.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Haddock/GHC/Utils.hs b/src/Haddock/GHC/Utils.hs index 08eb4fb5..cfe0a83b 100644 --- a/src/Haddock/GHC/Utils.hs +++ b/src/Haddock/GHC/Utils.hs @@ -10,6 +10,7 @@ module Haddock.GHC.Utils where import Debug.Trace import Data.Char +import qualified Data.Map as Map import GHC import HsSyn @@ -50,6 +51,13 @@ mkModuleNoPkg str = mkModule (stringToPackageId "") (mkModuleName str) modulePkgStr = packageIdString . modulePackageId +-- Instances + + +instance (Outputable a, Outputable b) => Outputable (Map.Map a b) where + ppr m = ppr (Map.toList m) + + -- misc @@ -74,5 +82,8 @@ getMainDeclBinder _ = Nothing --modInfoName = moduleName . mi_module . minf_iface --modInfoMod = mi_module . minf_iface +pretty :: Outputable a => a -> String +pretty x = show (ppr x defaultUserStyle) + trace_ppr x y = trace (showSDoc (ppr x)) y |