[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: Fix colors in emacs terminal

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Feb 6 08:32:28 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
5a54ac0b by Bodigrim at 2023-02-04T18:48:32-05:00
Fix colors in emacs terminal

- - - - -
3c0f0c6d by Bodigrim at 2023-02-04T18:49:11-05:00
base changelog: move entries which were not backported to ghc-9.6 to base-4.19 section

- - - - -
291ddd54 by Luite Stegeman at 2023-02-06T03:32:16-05:00
Fix marking async exceptions in the JS backend

Async exceptions are posted as a pair of the exception and
the thread object. This fixes the marking pass to correctly
follow the two elements of the pair.

Potentially fixes #22836

- - - - -
e37532fb by Jan HrĨek at 2023-02-06T03:32:20-05:00
Remove extraneous word in Roles user guide

- - - - -


5 changed files:

- compiler/GHC/SysTools/Terminal.hs
- docs/users_guide/exts/roles.rst
- libraries/base/changelog.md
- rts/js/gc.js
- utils/ghc-pkg/Main.hs


Changes:

=====================================
compiler/GHC/SysTools/Terminal.hs
=====================================
@@ -5,6 +5,7 @@ module GHC.SysTools.Terminal (stderrSupportsAnsiColors) where
 import GHC.Prelude
 
 #if !defined(mingw32_HOST_OS)
+import System.Environment (lookupEnv)
 import System.IO (hIsTerminalDevice, stderr)
 #else
 import GHC.IO (catchException)
@@ -36,8 +37,10 @@ stderrSupportsAnsiColors = unsafePerformIO stderrSupportsAnsiColors'
 stderrSupportsAnsiColors' :: IO Bool
 stderrSupportsAnsiColors' = do
 #if !defined(mingw32_HOST_OS)
-    -- Coloured text is a part of ANSI standard, no reason to query terminfo
-    hIsTerminalDevice stderr
+  -- Equivalent of https://hackage.haskell.org/package/ansi-terminal/docs/System-Console-ANSI.html#v:hSupportsANSI
+  isTerminal <- hIsTerminalDevice stderr
+  term <- lookupEnv "TERM"
+  pure $ isTerminal && term /= Just "dumb"
 #else
   h <- Win32.getStdHandle Win32.sTD_ERROR_HANDLE
          `catchException` \ (_ :: IOError) ->


=====================================
docs/users_guide/exts/roles.rst
=====================================
@@ -103,7 +103,7 @@ hand, has its parameter at role nominal, because ``Complex Age`` and
 Role inference
 --------------
 
-What role should a given type parameter should have? GHC performs role
+What role should a given type parameter have? GHC performs role
 inference to determine the correct role for every parameter. It starts
 with a few base facts: ``(->)`` has two representational parameters;
 ``(~)`` has two nominal parameters; all type families' parameters are


=====================================
libraries/base/changelog.md
=====================================
@@ -1,5 +1,10 @@
 # Changelog for [`base` package](http://hackage.haskell.org/package/base)
 
+## 4.19.0.0 *TBA*
+  * Add `Data.List.!?` ([CLC proposal #110](https://github.com/haskell/core-libraries-committee/issues/110))
+  * `maximumBy`/`minimumBy` are now marked as `INLINE` improving performance for unpackable
+    types significantly.
+
 ## 4.18.0.0 *TBA*
   * `Foreign.C.ConstPtr.ConstrPtr` was added to encode `const`-qualified
     pointer types in foreign declarations when using `CApiFFI` extension. ([CLC proposal #117](https://github.com/haskell/core-libraries-committee/issues/117))
@@ -63,9 +68,6 @@
   * Add `Data.Typeable.heqT`, a kind-heterogeneous version of
     `Data.Typeable.eqT`
     ([CLC proposal #99](https://github.com/haskell/core-libraries-committee/issues/99))
-  * Add `Data.List.!?` ([CLC proposal #110](https://github.com/haskell/core-libraries-committee/issues/110))
-  * `maximumBy`/`minimumBy` are now marked as `INLINE` improving performance for unpackable
-    types significantly.
 
 ## 4.17.0.0 *August 2022*
 


=====================================
rts/js/gc.js
=====================================
@@ -493,7 +493,8 @@ function h$follow(obj, sp) {
 		    }
                 }
 		for(i=0;i<c.excep.length;i++) {
-		    ADDW(c.excep[i]);
+		    ADDW(c.excep[i][0]); // the posting thread
+		    ADDW(c.excep[i][1]); // the exception
 		}
             } else if(c instanceof h$Transaction) {
                 // - the accessed TVar values don't need to be marked


=====================================
utils/ghc-pkg/Main.hs
=====================================
@@ -86,6 +86,7 @@ import qualified Data.ByteString as BS
 #if defined(mingw32_HOST_OS)
 import GHC.ConsoleHandler
 #else
+import System.Environment (lookupEnv)
 import System.Posix hiding (fdToHandle)
 #endif
 
@@ -1591,8 +1592,9 @@ listPackages verbosity my_flags mPackageName mModuleName = do
                           pkg = display (mungedId p)
 
     is_tty <- hIsTerminalDevice stdout
-    -- Coloured text is a part of ANSI standard, no reason to query terminfo
-    mapM_ (if is_tty then show_colour else show_normal) stack
+    -- Equivalent of https://hackage.haskell.org/package/ansi-terminal/docs/System-Console-ANSI.html#v:hSupportsANSI
+    term <- lookupEnv "TERM"
+    mapM_ (if is_tty && term /= Just "dumb" then show_colour else show_normal) stack
 #endif
 
 simplePackageList :: [Flag] -> [InstalledPackageInfo] -> IO ()



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/35b15d67e762520818b5983a2fabd92477bb776e...e37532fb5f792f3a8a11686c1556ad07d12f62ec

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/35b15d67e762520818b5983a2fabd92477bb776e...e37532fb5f792f3a8a11686c1556ad07d12f62ec
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230206/b2dcb145/attachment-0001.html>


More information about the ghc-commits mailing list