From: Matthijs Kooijman Date: Sun, 21 Jun 2009 18:43:46 +0000 (+0200) Subject: Add pprString convenience method. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=2fa8431a83031128428caa8f833a3396de34536f;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git Add pprString convenience method. This method can convert any Outputable to a string. --- diff --git a/Pretty.hs b/Pretty.hs index b2ac91d..7896372 100644 --- a/Pretty.hs +++ b/Pretty.hs @@ -1,4 +1,4 @@ -module Pretty (prettyShow) where +module Pretty (prettyShow, pprString) where import qualified Data.Map as Map @@ -151,3 +151,7 @@ instance (Pretty k, Pretty v) => Pretty (Map.Map k v) where where ppentry (k, v) = pPrint k <> text " : " $$ nest 15 (pPrint v) + +-- Convenience method for turning an Outputable into a string +pprString :: (Outputable x) => x -> String +pprString = showSDoc . ppr