summaryrefslogtreecommitdiff
path: root/libraries/base/System/Exit.hs
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2014-04-21 11:34:38 +0800
committerHerbert Valerio Riedel <hvr@gnu.org>2014-04-21 17:18:17 +0200
commit77ea2eb0ab36d1a610269f6737b509b6f6a376fa (patch)
treee521413cd1ce50d935a316a3831385cf8dee15fe /libraries/base/System/Exit.hs
parente2b14c70c800363db5ccb5c3032eed8b9d7d3747 (diff)
downloadhaskell-77ea2eb0ab36d1a610269f6737b509b6f6a376fa.tar.gz
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.
Diffstat (limited to 'libraries/base/System/Exit.hs')
-rw-r--r--libraries/base/System/Exit.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base/System/Exit.hs b/libraries/base/System/Exit.hs
index a3059fcf9b..4f6eba629c 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