diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/PprLib.hs | 2 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs index 230bd43a8f..0f740a18f7 100644 --- a/libraries/template-haskell/Language/Haskell/TH/PprLib.hs +++ b/libraries/template-haskell/Language/Haskell/TH/PprLib.hs @@ -35,7 +35,7 @@ module Language.Haskell.TH.PprLib ( ) where -import Language.Haskell.TH.Syntax (Name(..), NameFlavour(..)) +import Language.Haskell.TH.Syntax (Name(..), showName, NameFlavour(..)) import qualified Text.PrettyPrint.HughesPJ as HPJ import Control.Monad (liftM, liftM2) import Data.Map ( Map ) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 5485bc95d6..4399e35415 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -22,7 +22,7 @@ module Language.Haskell.TH.Syntax( currentModule, runIO, -- Names - Name(..), mkName, newName, nameBase, nameModule, + Name(..), mkName, newName, nameBase, nameModule, showName, -- The algebraic data types Dec(..), Exp(..), Con(..), Type(..), Cxt, Match(..), @@ -50,6 +50,7 @@ import Data.IORef import GHC.IOBase ( unsafePerformIO ) import Control.Monad (liftM) import System.IO ( hPutStrLn, stderr ) +import Data.Char ( isAlpha ) ----------------------------------------------------- -- @@ -432,10 +433,10 @@ instance Ord NameFlavour where (NameG _ _ _) `compare` other = GT showName :: Bool -> Name -> String -showName pflg nm | pf && pnam = nms - | pf = "(" ++ nms ++ ")" - | pnam = "`" ++ nms ++ "`" - | otherwise = nms +showName pflg nm | pflg && pnam = nms + | pflg = "(" ++ nms ++ ")" + | pnam = "`" ++ nms ++ "`" + | otherwise = nms where -- For now, we make the NameQ and NameG print the same, even though -- NameQ is a qualified name (so what it means depends on what the |