
+1 adding to System.Exit
-0.5 adding to Prelude
Tom
El Dec 15, 2013, a las 18:50, John Lato
+1 to adding 'die' to System.Exit -1 to adding to Prelude
I've pretty much only wanted this in command-line type programs, but as the proposal notes, it's very frequently required in that situation.
John L.
On Sat, Dec 14, 2013 at 2:56 AM, Simon Hengel
wrote: Hi! I propose to add
die :: String -> IO () die err = hPutStrLn stderr err >> exitFailure
to System.Exit.
Reasoning:
(1) It's a frequently required functionality. Almost every command-line program has code similar to this.
(2) The definition is relatively short, but in addition to the definition, you need two import statements.
(3) It's frequently done wrong (e.g. writing to stdout instead of stderr, or not using exitFailure, or both).
I haven't done any extensive research on Hackage, but I quickly looked at Haddock. Here we have a definition of die [1], but we also print to stdout at a couple of place and then call exitFailure [2].
Personally, I think it should be re-exported from Prelude. But this may be controversial. So let's have two separate votes:
Add System.Exit.die: +1 Re-export it from Prelude: +1
(discussion until December, 28th)
Cheers, Simon
[1] https://github.com/ghc/haddock/blob/8d4c94ca5a969a5ebbb791939fb0195dc672429e... [2] https://github.com/ghc/haddock/blob/c6faeae064668125721b0d5e60f067f90c538933... _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries