[commit: ghc] ghc-8.0: Print * has Unicode star with -fprint-unicode-syntax (3b3be92)

git at git.haskell.org git at git.haskell.org
Thu Feb 11 15:30:07 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/3b3be9266d387581c906fc403e15da09ff3202b8/ghc

>---------------------------------------------------------------

commit 3b3be9266d387581c906fc403e15da09ff3202b8
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
    
    (cherry picked from commit da19c136f3e8e73a3713acb5e5802e0f28db8efd)


>---------------------------------------------------------------

3b3be9266d387581c906fc403e15da09ff3202b8
 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 3d80370..5f7f7ca 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1813,7 +1813,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 5d039c4..bff5603 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -2455,7 +2455,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 1abb1c5..3ada62b 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