From 2fb84ba8be505906e73f1c84405c639646c8a30e Mon Sep 17 00:00:00 2001 From: David Waern Date: Sun, 21 Oct 2007 14:34:26 +0000 Subject: Add some Outputable utils --- src/Haddock/GHC/Utils.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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 -- cgit v1.2.3