[commit: ghc] master: Add System.Exit.die (re #9016) (77ea2eb)

git at git.haskell.org git at git.haskell.org
Mon Apr 21 15:18:50 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/77ea2eb0ab36d1a610269f6737b509b6f6a376fa/ghc

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

commit 77ea2eb0ab36d1a610269f6737b509b6f6a376fa
Author: Simon Hengel <sol at typeful.net>
Date:   Mon Apr 21 11:34:38 2014 +0800

    Add System.Exit.die (re #9016)
    
    The original proposal discussion can be found at
    
      http://thread.gmane.org/gmane.comp.lang.haskell.libraries/20872
    
    Note this also updates the Haddock submodule to remove Hadock's local
    `die` implementation.


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

77ea2eb0ab36d1a610269f6737b509b6f6a376fa
 libraries/base/System/Exit.hs |    7 +++++++
 libraries/base/changelog.md   |    2 ++
 utils/haddock                 |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libraries/base/System/Exit.hs b/libraries/base/System/Exit.hs
index a3059fc..4f6eba6 100644
--- a/libraries/base/System/Exit.hs
+++ b/libraries/base/System/Exit.hs
@@ -20,9 +20,11 @@ module System.Exit
     , exitWith
     , exitFailure
     , exitSuccess
+    , die
   ) where
 
 import Prelude
+import System.IO
 
 import GHC.IO
 import GHC.IO.Exception
@@ -74,3 +76,8 @@ exitFailure = exitWith (ExitFailure 1)
 exitSuccess :: IO a
 exitSuccess = exitWith ExitSuccess
 
+-- | Write given error message to `stderr` and terminate with `exitFailure`.
+--
+-- /Since: 4.7.1.0/
+die :: String -> IO ()
+die err = hPutStrLn stderr err >> exitFailure
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index a72e4e6..c561165 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -8,6 +8,8 @@
 
   * Add `Data.List.sortOn` sorting function
 
+  * Add `System.Exit.die`
+
   * Weaken RealFloat constraints on some `Data.Complex` functions
 
 ## 4.7.0.0  *Apr 2014*
diff --git a/utils/haddock b/utils/haddock
index ac60bd1..08aa509 160000
--- a/utils/haddock
+++ b/utils/haddock
@@ -1 +1 @@
-Subproject commit ac60bd1f98ad02644d3ea36dd4926ed6e105c789
+Subproject commit 08aa509ebac58bfb202ea79c7c41291ec280a1c5



More information about the ghc-commits mailing list