X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FName.lhs;h=bbc249f053a5697c6336564e111c6a30138c9f1a;hb=28dd45d2429a87c64d472fd2a35c146600ea3ee5;hp=7dfed64a81f6ff6211531a7c07bad6080d0164c4;hpb=526c3af1dc98987b6949f4df73c0debccf9875bd;p=ghc-hetmet.git diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs index 7dfed64..bbc249f 100644 --- a/compiler/basicTypes/Name.lhs +++ b/compiler/basicTypes/Name.lhs @@ -32,7 +32,8 @@ module Name ( -- Class NamedThing and overloaded friends NamedThing(..), - getSrcLoc, getSrcSpan, getOccString + getSrcLoc, getSrcSpan, getOccString, + pprInfixName, pprPrefixName ) where import {-# SOURCE #-} TypeRep( TyThing ) @@ -422,5 +423,11 @@ getOccString :: NamedThing a => a -> String getSrcLoc = nameSrcLoc . getName getSrcSpan = nameSrcSpan . getName getOccString = occNameString . getOccName + +pprInfixName, pprPrefixName :: (Outputable a, NamedThing a) => a -> SDoc +-- See Outputable.pprPrefixVar, pprInfixVar; +-- add parens or back-quotes as appropriate +pprInfixName n = pprInfixVar (isSymOcc (getOccName n)) (ppr n) +pprPrefixName n = pprPrefixVar (isSymOcc (getOccName n)) (ppr n) \end{code}