Proposal: Add die to System.Exit (and/or Prelude)

Simon Hengel sol at typeful.net
Sat Dec 14 10:59:16 UTC 2013


On Sat, Dec 14, 2013 at 11:56:11AM +0100, Simon Hengel wrote:
> I propose to add
> 
>     die :: String -> IO ()
>     die err = hPutStrLn stderr err >> exitFailure
> 
> to System.Exit.

An alternative implementation would be:

    die :: String -> IO ()
    die err = do
      name <- getProgramName
      hPutStrLn stderr (name ++ ": " ++ err) >> exitFailure

(not sure what's preferable)

Cheers.


More information about the Libraries mailing list