diff options
author | Nathan Collins <nathan.collins@gmail.com> | 2019-05-21 13:44:55 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-31 23:55:49 -0400 |
commit | 1d43d4a3e45d86261fa63591e99749cb7d3f68ed (patch) | |
tree | 14ac49ef975a2a4fd9c6214f202da16688f4673a | |
parent | 0e0d87da2fd25e2fb255417fcb15f93f508c1250 (diff) | |
download | haskell-1d43d4a3e45d86261fa63591e99749cb7d3f68ed.tar.gz |
Improve ThreadId Show instance
By making it include parens when a derived instance would. For example, this changes the (hypothetical) code `show (Just (ThreadId 3))` to produce `"Just (ThreadId 3)"` instead of the current `"Just ThreadId 3"`.
-rw-r--r-- | libraries/base/GHC/Conc/Sync.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs index 5c3e63a8e3..87491993f8 100644 --- a/libraries/base/GHC/Conc/Sync.hs +++ b/libraries/base/GHC/Conc/Sync.hs @@ -113,7 +113,7 @@ import GHC.IORef import GHC.MVar import GHC.Ptr import GHC.Real ( fromIntegral ) -import GHC.Show ( Show(..), showString ) +import GHC.Show ( Show(..), showParen, showString ) import GHC.Stable ( StablePtr(..) ) import GHC.Weak @@ -145,7 +145,7 @@ This misfeature will hopefully be corrected at a later date. -- | @since 4.2.0.0 instance Show ThreadId where - showsPrec d t = + showsPrec d t = showParen (d >= 11) $ showString "ThreadId " . showsPrec d (getThreadId (id2TSO t)) |