[commit: ghc] master: Print * has Unicode star with -fprint-unicode-syntax (da19c13)
git at git.haskell.org
git at git.haskell.org
Tue Feb 9 10:01:11 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/da19c136f3e8e73a3713acb5e5802e0f28db8efd/ghc
>---------------------------------------------------------------
commit da19c136f3e8e73a3713acb5e5802e0f28db8efd
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Mon Feb 8 16:29:04 2016 +0100
Print * has Unicode star with -fprint-unicode-syntax
Reviewers: austin, thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1893
>---------------------------------------------------------------
da19c136f3e8e73a3713acb5e5802e0f28db8efd
compiler/main/DynFlags.hs | 5 ++++-
compiler/types/TyCoRep.hs | 3 ++-
compiler/utils/Outputable.hs | 1 +
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 992f47d..0fa7434 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1817,7 +1817,10 @@ lang_set dflags lang =
extensionFlags = flattenExtensionFlags lang (extensions dflags)
}
--- | Check whether to use unicode syntax for output
+-- | An internal helper to check whether to use unicode syntax for output.
+--
+-- Note: You should very likely be using 'Outputable.unicodeSyntax' instead
+-- of this function.
useUnicodeSyntax :: DynFlags -> Bool
useUnicodeSyntax = gopt Opt_PrintUnicodeSyntax
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index bf61a13..6a13213 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -2648,7 +2648,8 @@ pprTyTcApp p tc tys
| tc `hasKey` tYPETyConKey
, [TyConApp lev_tc []] <- tys
- = if | lev_tc `hasKey` liftedDataConKey -> char '*'
+ = if | lev_tc `hasKey` liftedDataConKey ->
+ unicodeSyntax (char '★') (char '*')
| lev_tc `hasKey` unliftedDataConKey -> char '#'
| otherwise -> ppr_deflt
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index bf0cc90..259b554 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -35,6 +35,7 @@ module Outputable (
fsep, fcat,
hang, hangNotEmpty, punctuate, ppWhen, ppUnless,
speakNth, speakN, speakNOf, plural, isOrAre, doOrDoes,
+ unicodeSyntax,
coloured, PprColour, colType, colCoerc, colDataCon,
colBinder, bold, keyword,
More information about the ghc-commits
mailing list