summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.lhs
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-02-24 00:26:07 +0000
committerIan Lynagh <ian@well-typed.com>2013-02-24 00:26:07 +0000
commite2bea6019fd523d4b6061174b114c49f55fa981c (patch)
tree39fdc07fa029372343e888908686926fa07116a7 /compiler/utils/Outputable.lhs
parent085e8145f63c8f42d8bc19cd3cff52b8cd5b6455 (diff)
downloadhaskell-e2bea6019fd523d4b6061174b114c49f55fa981c.tar.gz
Use unicode quote characters in error messages etc; fixes #2507
We only use the unicode characters if the locale supports them.
Diffstat (limited to 'compiler/utils/Outputable.lhs')
-rw-r--r--compiler/utils/Outputable.lhs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs
index 9e83634fab..f26f918068 100644
--- a/compiler/utils/Outputable.lhs
+++ b/compiler/utils/Outputable.lhs
@@ -72,6 +72,7 @@ module Outputable (
import {-# SOURCE #-} DynFlags( DynFlags,
targetPlatform, pprUserLength, pprCols,
+ useUnicodeQuotes,
unsafeGlobalDynFlags )
import {-# SOURCE #-} Module( Module, ModuleName, moduleName )
import {-# SOURCE #-} Name( Name, nameModule )
@@ -448,7 +449,11 @@ cparen b d = SDoc $ Pretty.cparen b . runSDoc d
-- 'quotes' encloses something in single quotes...
-- but it omits them if the thing begins or ends in a single quote
-- so that we don't get `foo''. Instead we just have foo'.
-quotes d = SDoc $ \sty ->
+quotes d =
+ sdocWithDynFlags $ \dflags ->
+ if useUnicodeQuotes dflags
+ then char '‛' <> d <> char '’'
+ else SDoc $ \sty ->
let pp_d = runSDoc d sty
str = show pp_d
in case (str, snocView str) of